How to connect your static site to RSS

Reading time: 1 minute(s)

Modern website builders like WordPress usually come with RSS, but static websites do not. This means that we have to manually add the RSS code to our website and, every time we make a new page that we want to be on the feed, we must update the feed.

  • Create a file called feed.xml in your root folder. This is your main RSS feed that ‘lists’ your posts.
  • Paste the following code into it and save:
<?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>

  • In the above code, replace the following values.
    • atom:link href (must point to your .xml file)
    • <title> tag
    • <link> tag
    • <description> tag
    • <language> tag
  • Go to the page you would like to add to your RSS and edit.
  • Add this between your <head></head> tags:
    <link rel="alternate" type="application/rss+xml"
 href="/feed.xml" title="RSS">
  • Go back to feed.xml
  • Add this before the closing </channel> tag:
     <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>
  • In the above code, replace the following values.
    • <title> tag
    • <pubDate> tag
    • <link> tag
    • <guid> tag
    • <description> tag

Your feed.xml file should look 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 finished, validate your feed by pasting your feed.xml URL on this website – it will tell you if there are any errors found.

Leave a Comment