Using SSI with Wordpress
March 8, 2009
Server Side Includes (SSI) are a very powerful tool that can be used to update multiple pages on a site quickly and with minimum fuss.
e.g. Imagine you had a site and you wanted to include a list of recommended merchants at the bottom of every page. What happens if one of the merchants changes their affiliate link, or drops you as an affiliate, or simply does not convert? If you site had 100 pages, you would have to manually update 100 pages and re-upload all 100 pages.
With SSI, you would have this list of merchants in a single text file. You would then “include” that text file in all of the pages on your site.
If you need to change a link, you simply change the link in the text file and re-upload that one file. The merchant list will then be updated on every single page of your site.
Typically I’ll have 4 or 5 of these “merchant files” for any site I build. The list of merchants and ads shown in these files will be geared towards the section on my site in which they will appear. e.g. on a contact lens site, I would probably have one merchant file for the pages advertising prescription lenses, and another merchant file for cosmetic lenses (those lenses that are just for appearance). I might even have a separate file for “halloween lenses”, and include photos of vampire eyes, or cats eyes – whatever is hot at the moment.
By keeping my merchant lists to a few separate files, I can quickly and easily swap out merchants, add in new promotions (e.g. at Halloween there are always special offers, and these can be added to all “Halloween” related pages in a few seconds) and have total control over what ads are showing on the various sections of my website. If changes need to be made, I don’t need to edit every page on my site, just my include files.
Do you see the power of this?
To help with SSI in Wordpress sites, there is a plugin I recommend. I have it working on a Wordpress 2.7.1. installation so can confirm it is compatible with this version of Wordpress.
Wordpress Plugin: Include It
Download and install it.
Now, in an HTML editor (or text editor if you prefer), create the file that you want included in your pages. Construct it in standard HTML. It can include a table, headers, affiliate links, text, images etc. When you have finished the include file, save it to the root folder of your site. You can give it any name you want, e.g. merchants.txt, merchants.html etc.
Now, with the plugin active, simply add the following code in the position of your Wordpress post that you want the merchant list to appear:
[include file=merchant.txt]
Save your post, and you are finished.
The contents of the merchant.txt file should display in the post.
Add this line to every post you want the list to appear in. When you need to change the merchant list, simply edit the merchant.txt file, and upload it. The merchant list will be updated on every page that you added it to.
Do you have any other uses of SSI that you think readers of this blog would be interested in? Please feel free to leave comments on this article below. You do not need to register to leave a comment.
Print This Post





