RSS autodiscovery on every page (of a static site)

Thursday, July 10th, 2008

So you have some feeds and want browsers to be able to find them using autodiscovery.

The problem

Unfortunatly, you have static pages and would have to update each one to add the <link> tag. At PCC, we have a site composed of tens-of-thousands of pages. Some are static, some are dynamic applications we can alter, some are closed vendor products.

The solution

Like I said – we have many different types of pages. However, they all use the same JavaScript library!

JS is really good at inserting content into the page. We use the jQuery library, so adding a feed is as easy as:


/* add feed autofind! */
$("head").append('<link rel="alternate" type="application/rss+xml" title="News Releases | Portland Community College" href="http://www.pcc.edu/about/feeds/news/" />');

We can now add/remove feeds at a later date without opening every page on the site. If desired, the script could check the URL and only display the feed on appropriate pages, but for now lets put them everywhere.

Final Thoughts

I looked around the web, but didn’t see much discussion on this meathod. It seems to work in all modern browsers, but let me know if you find any problems.

TPR6: Adding Interactive Content to Your Website Using jQuery

Monday, October 15th, 2007

Jaclyn Whitehorn and Gina Tinny, The University of Alabama
Actually, only Jaclyn today.

What is it? A JavaScript library. Really good at quickly accessing and modifying any part of your page. Todays buzzword is unobtrusive!

She just threw down the fact that most of those cool Web2.0 effects are not really AJAX. It only becomes the big “A” when your page asynchronously talks to the server. I like her.

jQuery format:
(“Ready” is faster then page.onLoad(). This might solve our page flicker!)

$(document).ready( function() {
// Your code
});

For instance:
Selection: Take 3rd and 4th list item on the page:

$("ul > li").slice(2,4);

She then show some examples working with plug-ins. They are really slick. Would be a perfect addition to our hide/show FAQ. The only problem is that we currently use mootools. The next examples cover adding “.pdf” (which we already do), table striping (which we sometimes do). Very powerful.