Log in Sign up

Filter posts out of RSS feed based on tag?

Is there a way to not include posts with a set tag in the RSS feed?

4 replies Asked Jul 18 '22 at 17:04 · Improve this question

I do this on my RSS feed, it works the same way in any other template.

I wrap the portion in the feed with the excluded tag, i.e. apples:

{{^tagged.apples}}
  <item> 
    <title><![CDATA[ {{{title}}} ]]></title>
    <link>{{{absoluteURL}}}</link>
    <guid>{{{absoluteURL}}}</guid>
    {{! RSS feeds need a RFC 822 date}}
    <pubDate>{{#formatDate}}ddd, DD MMM YYYY HH:mm:ss ZZ{{/formatDate}}</pubDate>
    <description><![CDATA[ {{#absoluteURLs}} {{{body}}} {{/absoluteURLs}} ]]></description>
  </item>
{{/tagged.apples}}

-Ray

Answered Jul 18 '22 at 20:17 · Improve this answer

Would it be possible to use a version of this technique to output a feed for just one tag?

Answered Sep 21 '22 at 17:09 · Improve this answer

Yes! To convert a feed which ignores posts tagged apples, to a feed which only shows posts tagged apples, use the example above but replace this:

{{^tagged.apples}}

With this:

{{#tagged.apples}}

There's more about sections and inverted sections in the docs.

Answered Sep 21 '22 at 18:58 · Improve this answer

Thanks – much appreciated. Let the tinkering commence.

Answered Sep 22 '22 at 15:24 · Improve this answer

Markdown allowed