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.
Creating a feed file
To create your own feed, the first thing you'll need to do is create the feed file.
- 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.
- Paste the basic RSS skeleton:
- Replace the atom:link href with the full URL of your feed (this file you're currently editing)
- Fill out the values for title, link, description and language. You can find RSS language codes here.
<?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>
Adding pages to the feed
Now that the .xml file has been created, you can add some pages to it.
- Go to the page you'd like to add your RSS to, and add this code between your <head></head> tags:
- Return to your feed.xml file
- Before the closing </channel> tag, you will add this bit of text to represent that particular page or update:
- Change the values for the fields that appear. guid requires a unique ID so I find it easy just to use the URL.
<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.
<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.
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.