how to write RSS by hand

jun 21 2022


i write my HTML for my blog posts by hand. yeah, i'm crazy. there's plenty of good resources on how to do this online already (i reccomend w3cschools and MDN for referencing) so i'm not going to bother beating that dead horse today. however, no matter how hard i looked, i could not find any information on how to write an RSS file by hand. every single guide assumes that you use some sort of static site generator and just want everything handled for you. i don't!

this post is gonna assume you already know a bit of HTML, by the way. don't worry, it's not too hard to figure this stuff out.

STEP 1: the boilerplate stuff

yeah, it's XML, so there's lots of boilerplate. start by copying all of this junk into your favorite text editor.

feed.xml
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
  <channel>
    <title>SAMPLE TITLE</title>
    <description>SAMPLE DESCRIPTION</description>
    <link>https://example.com/</link>
    <image>
      <url>https://example.com/image.png</url>
      <title>SAMPLE IMAGE</title>
      <link>https://example.com/</link>
    </image>
	
  </channel>
</rss>

now it's time to customize it. block by block:

STEP 2: add posts

you may notice that your rss feed does not have any posts in it. the next step is to add those too. on the empty line, add this:

feed.xml
<item>
  <title>SAMPLE POST</title>
  <guid>https://example.com/foo/</guid>
  <description>SAMPLE DESCRIPTION</description>
  <pubDate>Sun, 19 Jun 2022 00:00:00 GMT</pubDate>
</item>

every time you add a new post, just repeat that, and you'll be good.

and by the way, you should use the W3C feed validator to double check once you're done!