how to write RSS by hand


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 recommend 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:

  • title is your site's title
  • description is a description of your site
  • link is a link to your site
  • image has a few children, so lets go over those individually
    • url is a link to your site's icon
    • title is the same as before
    • link is the same as before

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>
  <link>https://example.com/foo/</link>
  <description>SAMPLE DESCRIPTION</description>
  <pubDate>Sun, 19 Jun 2022 00:00:00 GMT</pubDate>
</item>

  • title is the title of your post
  • link is the URL to your post
  • description is a summary of your post
  • pubDate is the publication date of your post

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!