Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
a Summer day - @737.19 (what is this?)
Activity rating: Four Stars Posts & Arts: 73/1k.beats Random | Recent Posts | Guild Recents
News: :happy: Open the all windows! Your mind needs storms and air! :happy: Guild Events: HOMESTUCK ART-APALOOZA

+  MelonLand Forum
|-+  Life & The Web
| |-+  ✁ ∙ Web Crafting
| | |-+  Let's make a (basic, minimal) RSS feed!


« previous next »
Pages: [1] Print Embed
Author Topic: Let's make a (basic, minimal) RSS feed!  (Read 31 times)
Dan Q
Hero Member ⚓︎
*****
View Profile WWWArt


I have no idea what I am doing
⛺︎ My Room
RSS: RSS

Guild Memberships:
Artifacts:
Dan Q Cruisin'I DIDN'T meet Dan Q on Melonland!
« on: a Summer day » Embed

I've seen a lot of confusion over RSS feeds and how to make one. Let's have a go at making a simple one together.

(By the way: I'll be using the term "RSS feed" to refer to all technologies for web feeds, but there are really two major standards: RSS and Atom. You can use either; they're both widely supported. Or both! This guide will use RSS.)

What is an RSS feed?

An RSS feed is a web address that provides a list of "items", usually ordered by date, in a format designed to be read by machines. Each "item" in the feed might have a title, description, link, and/or attached metadata. They're really useful for:

- Blogs: each "item" can be (or point to) a blog post
- News: each "item" can be (or point to) a news article
- Site updates: each "item" can describe the changes you made today
- Podcasts: each "item" links to an MP3 file (this is how podcasts actually work!)

(Fun fact: did you know that every YouTube channel has an RSS feed too: it's a much better way to follow YouTube channels than using the site's built-in "subscribe" feature which (a) puts you at the mercy of their algorithm, (b) gives information about your interests to Google, and (c) makes it hard to "save" a video for later while continuing through a series, and remembering where you were up to.)

RSS feeds are super useful because people can subscribe to them using a feed reader. A feed reader downloads the RSS feeds you subscribe to on a schedule you choose. For example:

- I visit @PossiblyAxolotl's blog and go "that's really cool; I want to know when they write more!"
- I tell my feed reader (I use FreshRSS, but there are lots of other choices) to subscribe to that site
- Now, my feed reader checks the blog's RSS feed about 4 times a day, and - if there's a new post - it appears in my feed reader alongside all the other people who I follow!

Let's make an RSS feed!

Personally, I think the best way to make an RSS feed is... to have a computer make one for you. You can do this, for example, by using a static site generator or a CMS that will take your posts, turn them into a set of HTML pages, and also make an RSS feed that links to all those pages.

But today, we're going to keep things simple and do it by hand.

For the sake of example, I've made a quick Neocities site at rss-demo.neocities.org. If you visit it, you'll see that it's a blog with two (boring) posts:

- First Post! was published 1 July at https://rss-demo.neocities.org/post1
- Is this thing on? was published 7 July at https://rss-demo.neocities.org/post2

Let's make an RSS feed to describe those two posts (and any future ones that I choose to add!), so that people can subscribe to my new blog.

Step 1: making the XML feed

I've used the Neocities editor to make a new file called feed.xml. You can make it your own way (e.g. maybe you use a text editor on your own computer and upload later). You can call the file anything you like, but giving it a .xml extension helps ensure that your server understands what kind of file it is and doesn't send confusing messages to people's computers!

Here's my new file. I'll talk you though what each bit means in a moment:


Code
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>

  <title>My Demo Blog</title>
  <description>My demo blog; not terribly exciting!</description>
  <link>https://rss-demo.neocities.org/</link>
  <atom:link href="https://rss-demo.neocities.org/feed.xml" rel="self" type="application/rss+xml" />

  <item>
    <title>Is this thing on?</title>
    <description>More blogging, plus I made my RSS feed work!</description>
    <link>https://rss-demo.neocities.org/post2</link>
    <guid>https://rss-demo.neocities.org/post2</guid>
    <pubDate>Tue, 7 Jul 2026 12:00:00 +0000</pubDate>
  </item>

  <item>
    <title>First post!</title>
    <description>I started a blog.</description>
    <link>https://rss-demo.neocities.org/post1</link>
    <guid>https://rss-demo.neocities.org/post1</guid>
    <pubDate>Wed, 1 Jul 2026 12:00:00 +0000</pubDate>
  </item>

</channel>
</rss>

This is what I'd consider a pretty "minimal" RSS file... but in fact I've added a few "optional" things: it'd be possible to cut it down even more and still have it work. Anyway: it consists of the following:

<?xml version="1.0" encoding="UTF-8" ?>

This just says "I'm an XML file."

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">

This says two things:

1. I'm an RSS file (that's the kind of XML file I am!), using RSS version 2.0 (the latest version), and
2. I also use bits of the Atom standard (there's one particular bit of Atom that's super-useful, which we'll come to in a moment)

<channel> ... </channel>

Every RSS feed contains exactly one <channel>, wrapped around everything else. Think of it like the <html> of a HTML page: it's where everything else goes inside!

<title>My Demo Blog</title>
<description>My demo blog; not terribly exciting!</description>
<link>https://rss-demo.neocities.org/</link>


You must put a <title>, <description>, and <link> in your <channel>. The title can be the title of your site, or of your blog, or whatever. The description can be a one-liner to say what it is. The <link> should point at the web page that is the root of what the feed represents. So if your feed represents your whole site, put your site URL! If it represents just the stuff in the /blog/ folder, link to the homepage of the blog section.

Getting any of these "wrong" isn't a catastrophe. Just go back and change them later. But they need to be present!

<atom:link href="https://rss-demo.neocities.org/feed.xml" rel="self" type="application/rss+xml" />

This bit's optional, but recommended. We use the Atom standard to add a "link to ourself" in the RSS feed. That is: a link back to where the RSS feed can be found. Having this means that even if somebody downloads and saves the RSS feed somewhere, and "loses" where they found it, they can just look it up.

<item> ... </item>

A <channel> can contain any number of <items>: the "things" you want subscribers to know about. New subscribers will probably get everything listed (depending on their feed reader's settings), but their feed reader might make it easy to say e.g. "throw away everything over a month old" if they want. But once subscribed... every time you add a new <item>... they'll hear about it!


<title>First post!</title>
<description>I started a blog.</description>


Each <item> must have a <title>, or a <description>, or both. Everything else is optional.

Here I'm using the title of the blog post as the <title>, and I'm putting a summary of what it's about in the <description>.

It's possible to put the full HTML text of the post in the description (and people who love RSS will thank you for it), but you have to do this really carefully! If you choose to do this, you need a CDATA block to prevent the embedded HTML from making the XML invalid! To begin with, I'd recommend against putting full contents in the <description>. When you're ready to do to, see example 2 on this page (and be sure to carefully count the number of square brackets you need!).

<link>https://rss-demo.neocities.org/post1</link>

Optional but recommended, a <link> points to "where on the site can I see the HTML version of this <item>". That's probably the URL of a blog post, for example!

<guid>https://rss-demo.neocities.org/post1</guid>

Optional but recommended. A <guid> can be used by feed readers to detect if they're getting "duplicate" content, which can happen if e.g. RSS feeds get combined, or syndicated, or a particular item appears in multiple feeds. The easiest way to use these is just to give them the same value as your <link>! Alternatively, anything that's probably globally-unique is fine, e.g. the domain name for your site, then a space, then the date and time you wrote this item, perhaps.

<pubDate>Wed, 1 Jul 2026 12:00:00 +0000</pubDate>

Optional but recommended. T <pubDate> says "when was this <item> published?". It can be used by feed readers to "order" things, especially episodic content (like blog posts)!

If you add a <pubDate>, take care to follow the format exactly: some feed readers are really picky!

The date should be in the (horrible) RFC822 format; that is: (a) optional three-letter English day of week, followed by comma and space, (c) 1-2 digit day of month, (d) space, (e) three-letter English month name, (f) space, (g) four-digit year number, (h) space, (i) hours, minutes, seconds (seconds is optional), separated by colons, (j) space, (k) timezone as a + or - sign, two digit hours, two digit minutes, compared to UTC (OR one of several US-centric timezone codes). (You can just use +0000; nobody cares.)

Step 2: check your XML feed

The W3C operate a feed validator at https://validator.w3.org/feed/. Give it your feed URL and it'll tell you whether it's valid. Look, mine is!

(There's an alternative validator at https://www.rssboard.org/rss-validator/.)

If you test the same address multiple times (while debugging), watch out for caching! If you're making changes but they're not showing-up in the validator, consider "tweaking" the URL in a way that doesn't break it (e.g. test the same URL but with "?test1", "?test2" or similar on the end!): just remember this will invalidate your atom self-link! Or use "validate by direct input" mode and copy-paste your feed contents in!

If you want to simulate what your feed might look like in a real reader, the validators at https://rssvalidator.app/ and https://www.freecodeformat.com/rss-viewer.php will kind-of simulate that!

Step 3: share your feed URL

Now it's time to encourage your readers to subscribe to your feed!

Put a link to it on your homepage! That's a good start. But to get a gold star, add it to your site metadata too! Put this in the <head> section of your page (or even: every page of your site!) -


Code
<link href="/feed.xml" rel="alternate" title="RSS Feed for My Demo Blog" type="application/rss+xml">

Replace /feed.xml with the URL (relative or absolute) of your RSS feed, and the title with whatever you want to call it. Now, clever feed reader software can find your RSS feed... directly from the page! Some web browsers/plugins will automatically detect the feed and show "subscribe" buttons that connect directly to the feed reader! It's magical!

You can test that your <link...> tag is working using RSSBoard's validator. E.g. if you put "https://rss-demo.neocities.org/" into that validator, you'll see how they automatically find the URL of the RSS feed... because of that <link> tag. Feed readers can do this too.

Step 4? - use a feed reader yourself!

If you don't use a feed reader already... you should start!

If/when you do: consider subscribing to your own feed. This helps act as a canary to show you when there are problems. If you're writing an RSS feed by hand, like this, then introducing a problem is surprisingly easy, and it's nice to know if you did!

But if you want a real safe approach, try a free service like Feed Canary which will automatically email you if your RSS feed breaks (badly). That tool's saved my bacon at least once; I recommend it!

Logged

https://danq.me/_q26t/badges/dan-q-88x31-lighter.gif https://danq.me/_q26t/badges/dan-q-88x31-peekaboo-scroller.gif https://beige-buttons.danq.dev/beige-buttons-88x31.gif https://embed-html.danq.dev/embed-html-88x31.gif

Artifact Swap: PolyamorousI met Dan Q on Melonland!radio polyDoctor RedactedJoined 2025!
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi
MelonLand @000

Minecraft: Online
Join: craft.melonking.net