Samir's Corner - Written by Samir on Wednesday, July 2, 2008 19:01 - 0 Comments

Quick surefire guide to display latest blog posts on a static html web page

Okay so how do you display latest blog posts on an html page, to make the dynamic fresh content based websites. For e.g. www.guide5.com (see the bottom panel)

If your static page has .php extension then it’s very easy to achieve this but I am going to guide you on how to do this on a static .html page using RSS feeds from the blog

There are many ways to this, you can use JavaScript or free services like Feedburner BuzzBoost which is really great and easy to setup. But search engines don’t read JavaScript that well and SEO programmer‘s like me hate using Javascript  :)

So here we go!

We will use a php script to convert RSS feeds and display it on the website according to the design template. RSS Feeds could be from your blog, which is on your domain or from blogs on various other domains.

Well PHP scripts do not really work on html pages automatically. You need to process your .html files as PHP.

There are 2 simple options you can use to parse html as php.

1. .htaccess file
2. Cpanel Apache Handler’ Function
 

.htaccess file method

Open your .htaccess file in notepad and copy paste following line code, save it and upload it

AddType text/html .shtml .shtm .htm .html
AddHandler server-parsed .shtml .shtm .htm .html

Cpanel Apache Handler’ Function method

If you have access to cpanel then it’s very easy to parse html as php

1. Find apache handler icon and click on it

2. After clicking Apache Handlers link, you will go to a page which appear like the following image.  

 3. As you can see on the image, there is no instruction for html page listed Under Defined Handlers

Now add the following

Under Extension(s) add .html
Under Handler add server-parsed

Click on Add button

An Apache handler maintenance screen should appear


Well done!  you have parsed html files on your server. 

Note: if your page has .htm extensions then do the same for your .htm files

(Checkout Apache Handler Function method video NEW)

We are half way through! Now let’s flex those fingers and do little coding

We are going to use a great script made by Feedforall, which you can download here

Download and extract latestblog.zip on your computer, you will find two files latest-post.php and latest-post.html

Open latest-post.php in your favorite html editor.  I prefer Dreamweaver, you can also open the file with notepad. You need to look for following codes:

$XMLfilename = “http://examlple.com/feed/”;
$TEMPLATEfilename = “latest-blog.html”;
$FeedMaxItems = 10;

First you need to edit $XMLfilename (url) and replace it with your RSS feeds url

Next! You need to edit max number of post urls you want to display on your html page ($FeedMaxItems)

Tip: To display a particular category of your blog, you just need to put your category feed url instead of your blogs feed url.

Now you need to insert one line code in your static html page, to SSI include your blog feeds

<!–#include virtual=”latest-post.php”–>

Note: you need to save latest-post.php into the same directory as your html file, for the path to work.

You can control the look of your feed by using CSS

That’s it you are done, yes seriously you are done :)

I know there are several other ways to do this, but this is the easiest and if you feel you have an easier way, do state it down in the comments please.

I hope you liked this tutorial, if yes subscribe to this blog for other cutting edge SEO and internet marketing techniques.



Leave a Reply

Comment

News - Mar 17, 2010 17:13 - 0 Comments

Facebook Updates Search Service

More In News

Copywriting - Jul 29, 2010 18:06 - 0 Comments

SEO Copywriting to get Business Soaring

More In Copywriting

SEO Tools - Feb 23, 2010 18:16 - 0 Comments

The SEO Tactful Three

More In Search Engine Optimization