h1

Tricks to adding category feeds to static HTML pages

April 7, 2010

I wanted to create a static HTML page that would display both the latest blog feed as well as the latest blog feeds from within specific categories.

The reason for wanting this is that some of the categories might be more appealing to some potential readers than others, and even though my blog seems narrowly focused, I write a heck of a lot so even more narrowly focussed categories might be more appealing.

Unfortunately I can’t cut and paste and display the results here; WordPress.com has restrictions on scripting within posts and to use this you need to be able to accept javascript from Feedburner. But here’s a view of how the summarized blog feed looks on the static HTML page:

Main blog RSS feed

And, here’s how a couple of the category feeds look:

RSS blog category feed

(click image for full size if it’s not readable)

Note that there is some duplication, simply because some of the most recent entries are also in some of these categories, and also because some of the posts are in more than one category.

For archival purposes I’m saving an operating version of this HTML file here:

http://www.anon-poker-blog.com/rss-index.html

~

To get this all to work, I used this page, “Feedburner: How To Republish Blogger Feed as HTML” to help me to set up a Feedburner feed of my desired categories. But here’s where I got stuck, and I still don’t know why.

Feedburner would not accept the url for my categories. I would paste in the url, and Feedburner would return with multiple possibilities for the feed. One possibility that Feedburner would find would be the root of my blog, in other words a feed for the entire blog. The other possibility suggested by Feedburner would be a url that was only the most recent post in that category, not the entire category itself.

I experimented with different possible urls for the category feeds, and accidentally found something that worked:

http://www.anon-poker-blog.com/index/ ….

… category/poker-basics-for-beginners/feed/?cat=2/

(without the …., sorry; it’s too long to fit in this theme)

or, in more generic terms, (I run two blogs in one domain so each has it’s own directory; most blogs don’t need the “/index/” but that’s where the main blog exists separate from the other blog)

http://www.SITE.com/category/CATEGORYNAME/feed/?cat=2/

where the CAPITALIZED parts are unique to the site and category.

Why I needed both the “/feed/” and the “/?cat=2/” at the end I still don’t know. This is not even my second category, so I don’t know that the number even makes a difference, but for whatever reason this seemed to fool Feedburner into accepting the category feeds?

If anyone knows why this issue might have come up, please let me know.

Also, if there is a way of using PHP to generate the category feed in a static HTML page without using Feedburner at all, please let me know as well. I’m sure there is a way, but I haven’t been able to find one yet that is cheap (ie. free)

You can find more general information about setting up category feeds with WordPress here, Category Feeds With WordPress and Feedburner, but again this couldn’t help me solving the category feed problem and only helps with adding a pre-determined widget for category feeds. The other site mentioned at the top helps you to clip the script for the feed and then use it where ever you want with a static HTML page.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: