add date for each feed entry's link, to match gemlog specs.

Hi!

This is a little patch (and I  guess not well written as I never coded
in golang, before!) to make the  output of comitium matches the gemlog
specification.

This way  clients can subscribe to  the feed (if clients  supports the
standard, of course!).

Please consider merging if you find useful.

Bye!
C.
This commit is contained in:
cage
2026-04-24 11:13:01 +02:00
committed by nytpu
parent 8737a9a254
commit e68b88405f
+4 -3
View File
@@ -142,15 +142,16 @@ func (d *FullData) WriteFeed(dataPath string) error {
for _, entry := range pe.Entries {
// get just the date it was published
pub := toLocalDay(entry.Published)
formattedPubDay := entry.Published.Format("2006-01-02")
if pub.Before(curDay) {
curDay = pub
rawPage += fmt.Sprintf("\n\n## %s\n\n", curDay.Format("2006-01-02"))
rawPage += fmt.Sprintf("\n\n## %s\n\n", formattedPubDay)
}
if entry.Title == "" {
rawPage += fmt.Sprintf("=> %s %s\n", entry.URL, entry.Prefix)
rawPage += fmt.Sprintf("=> %s %s %s\n", entry.URL, formattedPubDay, entry.Prefix)
} else {
rawPage += fmt.Sprintf("=> %s %s — %s\n", entry.URL, entry.Prefix, entry.Title)
rawPage += fmt.Sprintf("=> %s %s %s — %s\n", entry.URL, formattedPubDay, entry.Prefix, entry.Title)
}
}
}