Top Tabs

Monday, July 9, 2007

When analyzing my traffic data I noticed that most of my posts were being read via their permalink page and that this percentage was steadily increasing. Digg, Reddit, StumbleUpon, and the links I post, rss feed links, and internal links all refer to the permalink of a post. As these are an increasing percentage of traffic I decided to find a way of removing ads from my main page posts and have ads that only appear on the permalink of a post. This is a great way to remove advertisement clutter from your main page (something I'm still working on) and place ads where the reader is more actively engaged and likely to follow the advertising.

Step 1As always the first thing you should do before making any changes to your template is to make a complete backup.

Step 2

Generate the ad code at whatever provider you decide to use and in the format you prefer, mine is a 468 x 60 banner. Now you will have to parse the code so that it can be placed into your template. If you don’t know how to do this using &; formatting or simply just don’t want to waste the time, then you can use this code parser (thanks Blogcrowds) to do it for you. Copy and paste your html ad code into the parser and then copy the output it gives you. This “parsed” code output is what you will paste into your template.

Step 3

Go back to your html edit page click and check the box to Expand Widget Templates

Step 4

Scroll down through the template code until you find the code that looks like this.

<div class="'post-header-line-1'/">

<div class="'post-body'">

<p><data:post.body/></p>

Step 5

Paste this code

<b:if cond="'data:blog.pageType"></b:if>

Into your template like this

<div class="'post-header-line-1'/">

<b:if cond="'data:blog.pageType"></b:if>

<div class="'post-body'"><p><data:post.body/></p>

Now if for some reason you want the ad at the end of your post past the code after the </p>

Step 6

Now paste your parsed ad code into the conditional if statement like this

<b:if cond="'data:blog.pageType">

Your parsed code here!

</b:if>

Step 7

Save your template. There that’s it. You now will have the ad block you created showing up in your post only when it is viewed via its permalink url.