Access page meta data while building the rss feed

Hi all,

This is how the rss feed is build on my site: https://gitlab.com/BeS/hugo-sustain-ng/blob/master/layouts/rss.xml

You see i have this magic in here:

{{ $slideReplacement := printf "<p>[Note: This blog contain some presentation slides, go to the <a href=\"%s\">original page</a> to see them.]</p>" .Permalink }} <description>{{ .Content | replaceRE "<div(.|\n)*?class=\"slides\"(.|\n)*?>(.|\n)*?</div>(.|\n)*?</div>(.|\n)*?</div>" $slideReplacement | html }}</description>

Basically it replaces embedded presentation slides with a link because in order to show them some special css and javascript is needed, both will not be available for RSS Readers. But this just as a side note. Now what I want to do is to provide this replacement string in multiple languages depending on the language used for the blog post. I use categories to define the language of a blog post, so there is a category “english” and “german”.

But I’m not able to access the “Categories” meta data of the blog post within the template. As “.Title” gives me the correct title of the page I tried “.Categories” and “.Category” but nothing works. Any tips how I can access this meta data and how I can check if the Categories contain a special value.

Thanks

RSS templates are a Page, and use Page variables. You are possibly looking for page-level params, something like .Params.categories.

1 Like

Thanks, works! :slight_smile: