Copied to clipboard

Using RSS on a static website

An RSS feed is a feed that anyone can subscribe to with a feed reader in order to receive updates about a website.

Many sites like Wordpress and Dreamwidth come with an RSS feed which is automatically generated from new posts. Static webhosts like Neocities don't have this functionality, so instead we must create and update a feed manually.

This means every time you want your feed subscribers to be notified that you've posted an update, you'll have to add a link to that page to your feed.

Neocities does sort of have a feed, but it consists of a single entry with the date and time of your last update. It updates automatically, even for minor changes. It is located at https://neocities.org/site/username.rss, just replace 'username' with your site username.

Creating a feed file

To create your own feed, the first thing you'll need to do is create the feed file.

  1. Create a file and name it something like feed.xml. This will be the file that you link to in order to share your feed.
  2. Paste the basic RSS skeleton:
  3. <?xml version="1.0" encoding="utf-8"?>
    <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
        <channel>
            <atom:link href="https://yourwebsite.neocities.org/feed.xml" rel="self" type="application/rss+xml" />
            <title>Your Website Title</title>
            <link>https://yourwebsite.neocities.org</link>
            <description>Your website description</description>
            <language>en-us</language>
        </channel>
    </rss>
                        
    1. Replace the atom:link href with the full URL of your feed (this file you're currently editing)
    2. Fill out the values for title, link, description and language. You can find RSS language codes here.

Adding pages to the feed

Now that the .xml file has been created, you can add some pages to it.

  1. Go to the page you'd like to add your RSS to, and add this code between your <head></head> tags:
  2. <link rel="alternate" type="application/rss+xml"
    href="/feed.xml" title="RSS">

    Make sure you change the href value to point correctly to your new feed file.

  3. Return to your feed.xml file
  4. Before the closing </channel> tag, you will add this bit of text to represent that particular page or update:
  5. <item>
        <title>My Page Title</title>
        <pubDate>Wed, 10 Nov 2021 15:52:00 EST</pubDate>
        <link>https://yourwebpage.neocities.org/page.html</link>
        <guid>https://yourwebpage.neocities.org/page.html</guid>
        <description>A description of the page.</description>
    </item>
                        

    The date you choose as your pubdate will influence when the notification goes out to your readers. If it's in the past, for example, a notification will not go out. Also, the formatting for this piece is picky, so make sure to follow it exactly.

  6. Change the values for the fields that appear. guid requires a unique ID so I find it easy just to use the URL.

At the end, your feed will look something like this:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
    <atom:link href="https://yourwebsite.neocities.org/feed.xml" rel="self" type="application/rss+xml" />
    <title>Your Website Title</title>
    <link>https://yourwebsite.neocities.org</link>
    <description>Your website description</description>
    <language>en-us</language>
        <item>
        <title>My Page Title</title>
        <pubDate>Wed, 10 Nov 2021 15:52:00 EST</pubDate>
        <link>https://yourwebpage.neocities.org/page.html</link>
        <guid>https://yourwebpage.neocities.org/page.html</guid>
        <description>A description of the page.</description>
        </item>
    </channel>
</rss>

When you're done, you can validate your feed file on this website, which will tell you if you've made any errors.