How to set language in index.xml?

I, how can I set the language for some RSS-feed index.xml files? E.g. I write all posts about “Elektronik” in german, but all posts of “Emacs” in english.

Hello Holger,

as far as I know it’s only possible to generate a single RSS feed per section, i.e. in your case posts. Does RSS allow you to set the language for a single article?

If so you can create you custom rss template that sets the locale for each post individually.

You should also have an eye on the i18n feature that will be integrated in one of the next releases. It will render an RSS feed per locale in your section:

I’m not sure if I understand you.

Does RSS allow you to set the language for a single article?

I don’t need to have a language per-post. I mean the language tag in the header of the generated xml, i.e. in the xml path RSS … CHANNEL … LANGUAGE. I don’t mean a language tage inside of the any of the ITEM xml entries.

What I want to to set the RSS language per RSS-feed (at least for some). For example, I want to have in has a language tag of “en”. It currently has “en” and is therefore wrong. I want to keep “de” in

Alternatively I want to remove the language tag IN THE RSS completely. Currently, it’s wrong in 50% of all cases.

Am I right that the RSS template from your link is baked into the hugo binary? So that it’s therefore not changeable? It contains this section:

{{ with .Site.LanguageCode }}{{.}}{{end}}

and this will therefore set the identical languagecode into any generated rss.xml, independent from the taxonomy and not changeable with some if/then/else logic inside the {{}}.

The binary itself includes a default template to generate an RSS feed for sections. But everything can be overwritten by the user. The RSS feed structure can be overwritten with custom RSS templates.

You could set the language code manually to deutsch, de or de-DE in all sections that only contain posts in German by deleting the {{ with .Site.LanguageCode }}{{.}}{{end}} snippet. Everything else can remain untouched.