Exclude shortcode output from RSS?

I have an RSS feed to go with my site.

I have a shortcode for a table of contents. I want this to appear in the site’s HTML, but not its RSS. I tried using {{ .Page.MediaType }} from the shortcode, but it appears as application/octet-stream for both the RSS feed and the HTML, so I can’t use it to differentiate between the HTML output and the RSS output.

Is there a better way to do this?

I would try with using Page methods like Type, or Kind, maybe you have set Layout…

use debug.Dump . to check if you have values there which identify your rss.

or the otherway round to identify non rss pages (kind page,section, …)

I think the only way is to provide a (empty?) shortcode for the RSS output format, e.g. /layouts/shortcodes/toc.xml)

1 Like

thanks, this worked!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.