Our blog’s RSS feed is one string join, and all five posts in it share one pubDate

https3A2F2Fdev-to-uploads.s3.us-east-2.amazonaws.com2Fuploads2Farticles2Fydhgkwmwk2ur7npgusli

Nakodo has a blog with five posts on it. The posts are TypeScript files: a title, a summary, and an array of typed blocks that one renderer turns into a page. There is no CMS and no markdown loader, so when I wanted a feed there was nothing to plug in. The whole feed is a route handler that joins strings. You can read the output before the code: nakodo.app/blog/feed.xml. $ curl -s -o /dev/null -w ‘%{http_code} %{size_download} %{content_type}n’ https://nakodo.app/blog/feed.xml 200 4774 application/rss+xml; charset=utf-8 The route The file is src/app/(marketing)/blog/feed.xml/route.ts. The dot in the folder name is the whole trick for the URL: a route segment can contain a dot, so feed.xml/route.ts answers at /blog/feed.xml with no rewrite and no config. import {…

Continue reading at DEV Community dev.to
Advertisement