Page MenuHomeFreeBSD

website: RSS fix news/feed.xml for ru and zh-tw
Needs ReviewPublic

Authored by vladlen on Nov 17 2025, 5:32 PM.
Tags
Referenced Files
Unknown Object (File)
Wed, Apr 1, 12:53 PM
Unknown Object (File)
Wed, Mar 18, 12:00 PM
Unknown Object (File)
Tue, Mar 17, 8:47 PM
Unknown Object (File)
Sun, Mar 15, 7:11 AM
Unknown Object (File)
Mar 5 2026, 12:29 PM
Unknown Object (File)
Mar 4 2026, 7:29 AM
Unknown Object (File)
Jan 15 2026, 12:56 AM
Unknown Object (File)
Dec 28 2025, 2:36 PM
Subscribers

Details

Reviewers
lwhsu
Group Reviewers
doceng
Summary

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

  1. Home page (index.html):

link is fixedwith the same variable as previously fixed link to translated news.

  1. 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).

Test Plan

cd website
bmake run

Diff Detail

Repository
R9 FreeBSD doc repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

vladlen created this revision.
carlavilla added inline comments.
website/themes/beastie/layouts/news/rss.xml
65

For me everything seems fine, but one question, "aaa" is a typo or something left that you used for debug?

website/themes/beastie/layouts/news/rss.xml
65

Haha, when I wrote it, it looked smart, but now after months it does look weird. It's not an error or debug leftover โ€” it's a placeholder for the 0th month that never gets used. slice creates an array indexed from 0, but dateFormat "1" returns month numbers starting from 1.

I think it'll raise fewer questions in the future if we remove "aaa" and subtract 1 from the month number instead:

{{ index $months (sub (int (dateFormat "1" .date)) 1) }}

It doesn't look super clean, but Go templates are Go templates โ€” sub is just how subtraction works here.

I will rebase this code and fix this 0th element trick.

tag <atom><pubDate>:
'0th month' name name removed (string "aaa"), month index subtracts 1 now. I hope, the code is cleaner now.