Your sites Log in Sign up Menu

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?


16 days ago, 6 replies   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 2 years ago · Improve this answer

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

Answered a year ago · 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 a year ago · Improve this answer

Thanks – much appreciated. Let the tinkering commence.

Answered a year ago · Improve this answer

I'm using the above method to limit posts tagged with 'linkpost' in my RSS feed. I'd also like to limit posts tagged with 'meta', since those are internal site mechanics posts that I think aren't for broad consumption.

What's the proper syntax to have multiple tags in the. exclusion criteria vs. just the one?

Answered 17 days ago · Improve this answer

I found the nested tag syntax in an answer to another post question.

Answered 16 days ago · Improve this answer

Privacy Terms