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:
+4
-3
@@ -142,15 +142,16 @@ func (d *FullData) WriteFeed(dataPath string) error {
|
|||||||
for _, entry := range pe.Entries {
|
for _, entry := range pe.Entries {
|
||||||
// get just the date it was published
|
// get just the date it was published
|
||||||
pub := toLocalDay(entry.Published)
|
pub := toLocalDay(entry.Published)
|
||||||
|
formattedPubDay := entry.Published.Format("2006-01-02")
|
||||||
if pub.Before(curDay) {
|
if pub.Before(curDay) {
|
||||||
curDay = pub
|
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 == "" {
|
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 {
|
} 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user