Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 274
deanvmc Avatar asked Sep 13 '11 10:09

deanvmc


People also ask

How do I find the RSS feed URL for a website?

It's easier than it sounds. Right click an empty space on the website you'd like an RSS feed for, then click View Page Source (the exact wording may vary depending on your browser). If searching for rss doesn't work, try atom instead. Look for an RSS URL, as you can see above, then copy it into your feed reader.

Do sites still use RSS?

While RSS feeds are still in use, they're becoming less popular with the use of social media and email subscriptions. Facebook, Twitter, and LinkedIn bring you the latest news from a site if you follow their profile.

Should I add RSS to my website?

Your RSS feed is important because it allows your readers to easily stay up-to-date on your latest content. Making your website's RSS feed easily accessible will allow your readers to keep up with your latest updates and articles – even when they're distracted by other things.


2 Answers

I use a static site generator for my blog (alexanderle.com) and ran into this problem.

I decided to created an RSS feed from scratch and it works great! Pretty easy to automate too if you have access to the template system or database. Editing the XML is not that difficult at all - if you can write simple HTML, you can edit a RSS XML file.

Check out the guide at https://alexanderle.com/create-an-rss-feed-from-scratch!

like image 171
alexcsm Avatar answered Sep 29 '22 08:09

alexcsm


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.

like image 23
Matt Gibson Avatar answered Sep 29 '22 08:09

Matt Gibson