htmlrssstatic-content

RSS for a static site


I have a site, deanvmc.me that I am using to teach myself HTML, CSS and JavaScript. The site is purposely static to strip my learning down to bear bones (The best way to learn I feel). I am using github as the host to further lock me down to statically generated content.

I would like to place some articles and tutorials on this site and feel that it would be nice to offer an RSS feed for both. The /Articles and /Tutorials directories will be used to list the content with the actual posts in the form of /Articles/ and /Tutorials/ respectively.

I have looked around but any tutorial I have found seems to rest upon me using one of the major CMS engines, which I do not what to do.

My understanding is RSS has been around longer than CMS engines, so my question is, is it possible to syndicate my static site?


Solution

  • It's a little tougher with static sites to get an RSS feed, because you can end up duplicating content unless you're prepared to add another tool to your site generation, or do a little bit of programming (and probably in a language different from the ones you're currently using.)

    As @Simone has mentioned, RSS is a simple format and easy to write. But if you just write an RSS feed on top of what you're doing right now, you'll obviously be duplicating some or all of the site content, which isn't ideal.

    So, I'd suggest that what you need is a way of taking your content and transforming it into an RSS feed -- or vice versa.

    When I created a static-content site with an RSS feed, the way I did it was to start with the RSS feed. Then I wrote some code that would take the RSS feed and create my HTML articles from it -- in my case I used XSLT to transform the RSS into a series of HTML files, but you could use any technology you want.

    Then, whenever I wanted to add an article to my static site, I'd edit the RSS feed just to add a new article with a new date, etc. to it (and there are tools around for various platforms for creating RSS feeds manually like this.) Then I'd run my code, which would "burn" my HTML articles, so I'd always end up with static articles and an RSS feed in line with each other, and only one "source" copy of the content.

    There's also tools out there for various platforms that can automate or semi-automate generating an RSS feed from a bunch of stuff on disk, which is a way of approaching the problem from the other direction.

    My answer, therefore, is that unless you're prepared to add another language or tool apart from CSS, HTML and Javascript to your repertoire, there's no very satisfactory way to add an RSS feed to a static site. If you just add it as a static file generated manually, then you have to update your content in two places if you edit an article, for example.

    You might also learn a lot from having a look at how the modern crop of RSS-friendly static site creation tools -- Jekyll, or its smarter derivative Octopress, for example -- do the job.