Blogfeed Readme

Blogfeed creates an RSS newsfeed from the HTML file of your blog. I created this so that I could generate an RSS feed for my Blogger powered blog, but Blogfeed can be used to create an RSS file from any HTML document.

Permission is granted to use this script on your site. If find it useful, please consider placing a link on your site to http://kalsey.com/web/xml/Blogfeed.html so that others may use it too. Oh, and email me the URL of your blog so that I can check it out.

Download

Blogfeed 1.0

Read the Version History to see what's new.

Configuration Instructions

To use Blogfeed, you need to make some modifications to your blog HTML.

At the beginning of each blog entry, put <span class="RSS:item">. At the end of each entry close the span with </span>. So if you are using Blogger, your template will contain
<span class="rss:item"><$BlogItemBody$></span>

Tip: If you want your RSS items to link to your site instead of to the first link in the description, change the above line in the Blogger template to:
<span class="rss:item"><a href="http://www.yourblog.com/#<$BlogItemNumber$>"></a><$BlogItemBody$></span>

Blogfeed gets the channel's title from the <title> tag in the HTML. The maximum length for this tag is 100 characters.

In the head section you will need to create several meta tags:

Meta Description will be used for the channel's description. You may already have this tag in place for some search engines. Maximum length is 500 characters.

<meta name="description" content="Some catchy description of your blog.">

Meta RSS:Link should be the URL of your blog. Maximum length is 500 characters.

<meta name="rss:link" content="http://www.kalsey.com/">

Meta rss:language is the language code for your blog. For US English, use en-us. For other language codes, go to http://backend.userland.com/stories/storyReader$16 and select the appropriate code.

<meta name="rss:language" content="en-us">

You can optionally include an image to identify your blog by using the rss:image meta. Place the full URL to your image in the meta tag. Maximum length is 500 characters.

<meta name="rss:image" content="http://www.kalsey.com/images/kalsey_btn.gif">

Once you have made these changes to your HTML, you will need to edit one line in Blogfeed.pl. A couple of lines after the instructions is a line that reads:

my $blog_file = "default.htm";

Change the filename that is in the quotes to be your blog's HTML file. If your HTML file is not in the same directory on the server as Blogfeed,you will also need to put the file path.

The next line in Blogfeed.pl can be changed if you want. The line my $strip_html = "True"; controls whether or not HTML code is removed from your feed items. Change the word True to False if you want to keep the HTML in your feed.

The last change that you may need to make is to edit the first line of the script to reflect the correct location of Perl. If your Web server runs Windows, you don't need to do this. If it runs Unix, you can get this info from your ISP.

That's it for the configuration (Wasn't that easy?). Now you are ready to install the script.

Installation

Installation is pretty simple too. You need to copy Blogfeed.pl, MD5.pm, Simple.pm, RSS.pm, and Blogfeed.ping to your server. If your Web server runs Windows, you're done. If it runs Unix, read on.

Unix users have to set permissions on the script and the ping file in order for this to work. Your FTP program probably has a button or a popup somewhere that you can use to set permissions. You'll need to set Blogfeed.pl and each of the .pm files to be executable and Blogfeed.ping to be readable and writeable.

If you are a Unix user and you can't set the permissions with your FTP program you will need to log into your server and change the directory that you uploaded the files to. Then type these commands:

chmod 755 Blogfeed.pl
chmod 755 *.pm

chmod 666 Blogfeed.ping

Now just point your readers to http://www.yourserver.com/Blogfeed.pl for your new RSS feed.

Version History

1.0b1
The perl module XML:RSS is used to produce the RSS text.
The source blog can now be called via a URL or a local file. This allows you to host Blogfeed on a different server from your blog.
Bug is fixed where the item link would sometimes not show up.

0.92
The meta tags are now HTML compliant. I was lazy before so they didn't comply. Now they do.
You have the option to strip HTML from the description tag for the items and just use plain text in your feed.
HTML is removed from the title for each item.
Text is escaped better. Now accented characters, quotes, and non alphanumeric characters are converted to the appropriate HTML entity.
Blogfeed notices if your blog has changed since the last time the feed was requested. If it has, it pings Weblogs.com for you.

0.91
Made the meta tags and the span tag case insensitive. So now <META>, <Meta>, and <meta> all work.

0.9
First public release

Acknowledgements

Thanks to Aaron Swartz's Blogify for the idea. I also lifted a regex from Julian Bond's rssify.