5 hours ago · Tech · 0 comments

If you open my rss feed url in your browser, you’ll won’t see raw XML content anymore, but a styled HTML page with the same header and footer as the main site, and a list of recent posts in between. This won’t affect feed readers, which will still see the original XML content. The styling is applied only when a human visits the feed URL in a browser, to make it more readable. I’ve achieved something similiar years ago with Jekyll, but never really got around to doing it in Hugo until recently. The idea is simple: Generate an Atom feed in Hugo1. Add xml-stylesheet to the XML. Create XSL files in static/xsl/ for a human-friendly browser view. Apply the same approach to sitemaps. Why Atom instead of Hugo’s native RSS? In this project I use Atom, not Hugo’s default RSS, for one practical reason: Atom supports an explicit updated field per entry. That lets feeds expose both publish and update timestamps (published and updated), which is useful for edited posts. 1. Disable default RSS and…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.