Skip to main content
GameDev.net gamedev.net

PRO Tired of ads? Read GameDev.net ad-free and help keep the community independent with GameDev Pro — $3/month.

RSS change

RSS change

superpig
Continuous Refinement · · 2 min read
422 0
In light of the new RSS feed on the front page, I've made some changes to the way RSS is handled across the site.

Previously, every single page on the site exposed the news feed (https://www.gamedev.net/xml/), and, optionally, one other feed with a custom URL and the same title as the page. That's obviously not great - it doesn't make sense to expose the news feed everywhere, some pages may need a second feed that doesn't match the page title, and the limit of two feeds per page is somewhat arbitrary anyway.

What we'd prefer, really, is a system that allows us to expose any number of feeds per page - including none - and to set the feed title and URL independently of anything else. And of course, any changes must not require changes to every page across the site. That would be madness.

Here's how the solution works:

  • We have a 'feed dictionary module' - just a VBScript code file - that can be included in pages that want to make use of the functionality. It exposes an AvailableFeeds Scripting.Dictionary object, along with two subroutines - ExposeFeed and GenerateFeedHTML.

  • If a page wants to expose feeds, it includes this script module and calls the ExposeFeed sub, passing the name and URL of a feed to expose. It can call ExposeFeed as many times as it wants, though it can't call it multiple times with the same feed name - that's fine, because we don't want users to be shown multiple feeds with identical names but different contents anyway.

  • Eventually, all pages go through the standard site header code. This code checks whether the AvailableFeeds object exists - only true if the feed module was included - and if so, calls GenerateFeedHTML to output the link markup.



A major shortcoming of SSI is that there's no way to discover which files have been included at any point in a script, so you can't easily tell whether some particular functions have been defined or not. Using the AvailableFeeds object like this is one way of determining that - it's like defining a symbol to use as an include guard. It's prone to name collisions - anyone else defining the name AvailableFeeds will cause problems - so to be extra safe I wrap the code in an "on error goto next" block to cause any errors to be silent.

Anyway, yes. It should be a lot simpler to expose RSS feeds on pages now, such that they integrate properly with your browser's UI.

Discussion

Loading comments...