Translated versions of website generate RSS feed for news from EN data directory.
This patch fixes this issue. The same approach is used as in https://reviews.freebsd.org/D53647 .
Implementation details
- Home page (index.html):
link is fixedwith the same variable as previously fixed link to translated news.
- RSS feed content (rss.xml):
The code section moved to the beginning of the file to make initialization (similar to D53647). Additional variables added.
tag <title> - for translated version added language code to have different titles in the RSS lists.
tag <link> - correct path for translated versions (containing language code)
tag <language> - for translated versions contains language code (2 or 5 chars - both variants are accepted by RSS format)
tag <image><link> - correct path for translated versions (containing language code)
tag <atom> - correct path for translated versions (containing language code)
tag <atom><link> - correct path for translated versions (containing language code)
tag <atom><guid> - correct path for translated versions (containing language code)
tag <atom><pubDate> - the expression from 3 parts is used instead fo dateFormat. dateFormat generates month name in local representation instead of 3-letters English abbreviation for months. Hugo documentation does not have any description how site language affects dateFormat output. In reality this output is translated to site language. RSS format require RFC 822 date formet, that accept only English 3-letter months names. Proposed expression always generates English month names based on month number returned by dateFormat (converted to int and index method is used to take name from slice with months names).