Setting up RSS Manually for my blog

October 24, 2019 | ~5 Minute Read

Initial Thoughts

So I have been looking for a way to set up RSS for my blog in the past couple of weeks, however I’m not fond of using a web tool for what seems like such a simple task. I wasn’t really familiar with how to create an RSS feed and it seems like everyone is more concerned with how to read an RSS feed. I must admit I was part of latter rather than the former.

I tried to look around for simple scripts that did this, and found all sorts of things from PHP libraries to online tools that crawl your website and then generate the RSS file. That all seemed great but I really didn’t know what those tools did, I’d rather know. Another thing that created a pain was that I really wanted to do it now, so writing it from scratch seemed like the option to go with, however seeing as I’m currently still learning CSS/Javascript, and my plan is to move over to PHP once “I’m ready”, I thought I shouldn’t put too many things on my plate all at once.

As I pondered about this I looked at how RSS was actually created and its story, and found it’s latest definition and took a look at it. I had not actually taken the time to take a look at what an actual file would look like. It’s not that complicated, so I thought I would actually do it by hand at this stage since I only actually have a handful of blog entries thus far. I suppose that as the entries grow I would have to find a method of updating the RSS file programmatically, however I believe that for now and for the posts I have, creating it manually shouldn’t be that bad or time consuming.

Configuration

So I simply got a sample file from the documentation posted by Harvard and read the field descriptions and wrote it out.

This is the sample file that I got:

  <rss version="2.0">
<channel>
  <title>Liftoff News</title>
  <link>http://liftoff.msfc.nasa.gov/</link>
  <description>Liftoff to Space Exploration.</description>
  <language>en-us</language>
  <pubDate>Tue, 10 Jun 2003 04:00:00 GMT</pubDate>
  <lastBuildDate>Tue, 10 Jun 2003 09:41:01 GMT</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Weblog Editor 2.0</generator>
  <managingEditor>editor@example.com</managingEditor>
  <webMaster>webmaster@example.com</webMaster>
  <item>
    <title>Star City</title>
    <link>http://liftoff.msfc.nasa.gov/news/2003/news-starcity.asp</link>
    <description>How do Americans get ready to work with Russians aboard the International Space Station? They take a crash course in culture, language and protocol at Russia's <a href="http://howe.iki.rssi.ru/GCTC/gctc_e.htm">Star City</a>.</description>
    <pubDate>Tue, 03 Jun 2003 09:39:21 GMT</pubDate>
    <guid>http://liftoff.msfc.nasa.gov/2003/06/03.html#item573</guid>
  </item>
  <item>
    <description>Sky watchers in Europe, Asia, and parts of Alaska and Canada will experience a <a href="http://science.nasa.gov/headlines/y2003/30may_solareclipse.htm">partial eclipse of the Sun</a> on Saturday, May 31st.</description>
    <pubDate>Fri, 30 May 2003 11:06:42 GMT</pubDate>
    <guid>http://liftoff.msfc.nasa.gov/2003/05/30.html#item572</guid>
  </item>
  <item>
    <title>The Engine That Does More</title>
    <link>http://liftoff.msfc.nasa.gov/news/2003/news-VASIMR.asp</link>
    <description>Before man travels to Mars, NASA hopes to design new engines that will let us fly through the Solar System more quickly.  The proposed VASIMR engine would do that.</description>
    <pubDate>Tue, 27 May 2003 08:37:32 GMT</pubDate>
    <guid>http://liftoff.msfc.nasa.gov/2003/05/27.html#item571</guid></item>
  <item>
  <title>Astronauts' Dirty Laundry</title>
    <link>http://liftoff.msfc.nasa.gov/news/2003/news-laundry.asp</link>
    <description>Compared to earlier spacecraft, the International Space Station has many luxuries, but laundry facilities are not one of them.  Instead, astronauts have other options.</description>
    <pubDate>Tue, 20 May 2003 08:56:02 GMT</pubDate>
    <guid>http://liftoff.msfc.nasa.gov/2003/05/20.html#item570</guid>
  </item>
</channel>
  </rss>

We basically have a block that will remain intact at the top of the file which is what defines the channel for the feed. The channel tag is only to be used once for the file, so this defines the website that provides the feed pretty much. Once that is done, you simply add the entries that you want to have seen by the world following the RSS format and that’s it. A single file with tags, so I just opened a new file called feed.xml in vim and modified the sample file with my own content. This is the final file:

  <rss version="2.0">
<channel>
  <title>Nixing | Linux Adventures</title>
  <link>https://nixing.mx/feed.xml>
  <description>Blog about my journey in the Linux and Development world</description>
  <language>en-us</language>
  <pubDate>Thu, 24 Oct 2019 14:05:00 GMT</pubDate>
  <lastBuildDate>Thu, 24 Oct 2019 14:05:00 GMT</lastBuildDate>
  <item>
    <title>Setting up RSS Manually for my blog</title>
    <link>http://nixing.mx/blog/.html</link>
    <description>How I set up RSS manually using the 2.O Specification</description>
    <pubDate>Thu, 24 Oct 2019 09:39:21 GMT</pubDate>
    <guid>http://nixing.mx/blog/.html</guid>
  </item>
  <item>
    <title>Setting up Nginx as a reverse proxy with Docker</title>
    <link>http://nixing.mx/blog/nginx-reverse-proxy-on-docker.html</link>
    <description>This is a post that details how I got Nginx on Docker to be a reverse web proxy for four different backend services.</description>
    <pubDate>Tue, 22 Oct 2019 09:39:21 GMT</pubDate>
    <guid>http://nixing.mx/blog/nginx-reverse-proxy-on-docker.html</guid>
  </item>
  <item>
    <title>Setting up My Blog</title>
    <link>http://nixing.mx/blog/Blog-creation.html</link>
    <description>These are the details of how I set up my blog in a simple fashion and from scratch, no frameworks used.</description>
    <pubDate>Thu, 17 Oct 2019 09:39:21 GMT</pubDate>
    <guid>http://nixing.mx/blog/Blog-creation.html</guid>
  </item>
  <item>
    <title>i3 Window Manager freezing on Slackware 14.2</title>
    <link>https://nixing.mx/blog/i3-freezing.html</link>
    <description>There seemed to be a bug in my system where i3 would freeze suddenly upon certain actions, I finally got around to checking this once and for all.</description>
    <pubDate>Wed, 16 Oct 2019 09:39:21 GMT</pubDate>
    <guid>http://nixing.mx/blog/i3-freezing.html</guid>
  </item>
</channel>
  </rss>

Then I had to add it to the blog’s HTML, I did that with a simple line:

  <li id="feed"><a href="feed.xml"><img src="img/feed.png" alt="RSS Icon"></a></li>

This would depend a lot on where you would want to set it up, but I will try at the top right for now and see if I’m happy with that. I think it should be accessible on every page but not be too intrusive, so that’s my reasoning behind it being there.

In my case and because of how I have my workflow set up for the blog, I had to also include it in the header.txt file that I use for my blog script.

I also applied some CSS to it, but it was just a single entry as well:

  float: right;

With that set up it was as simple as making it available at the web root of nixing.mx and that was it!

Conclusion

I think it’s good to keep it simple, in this case it didn’t seem too hard, I will still have to add entries for other parts of the website like the application and game development, but I will simply add them in over time when there is an update to those sections. I’m happy with this for now and will continue to update it manually until I get annoyed or find a better solution.