Tag Archives: Blogger

Show AdSense Only on Post Pages

If your blog covers a variety of topics, the relevance of Google AdSense ads on the main/index page suffers as it tries to figure out what to display. To minimize this problem, you can restrict the ads to the post pages only where the content is more focused. Here’s how to do it on Blogger.

  1. Log into your blog
  2. Click the Template tab
  3. If you don’t already have an AdSense widget on your blog, add one on the Page Elements page
  4. Make a backup of your template by clicking on the Download Full Template link
  5. On the Edit HTML page, select the Expand Widget Templates checkbox
  6. Scroll down to about the bottom quarter of the template contents (the position will vary based on the template you’re using and number of widgets in your blog)
  7. Look for the following widget code (if you have more than one AdSense widget, there will be more than one of these code blocks, each with a different id)
    <b:widget id=’AdSense1′ locked=’false’ title=” type=’AdSense’>
    <b:includable id=’main’>
    <div class=’widget-content’>
    <data:adCode/>
    </div>
    </b:includable>
    </b:widget>
  8. Add the following <b:if> and </b:if> tags so that the widget looks like the one below
    <b:widget id=’AdSense1′ locked=’false’ title=” type=’AdSense’>
    <b:includable id=’main’>
    <b:if cond=’data:blog.pageType == “item”‘>
    <div class=’widget-content’>
    <data:adCode/>
    </div>
    </b:if>
    </b:includable>
    </b:widget>
  9. Repeat for any other ad widgets you have on your blog
  10. Save the template and then view your blog

The contents of the ad widget should now only appear when viewing an individual post.

Note that the Blogger help topic, Page Elements Tags for Layouts, indicates that a widget tag can have a pageType attribute that, when set to “item”, is supposed to display that widget only on post pages. However, it didn’t work for the AdSense widget. So, I added an if condition to the widget’s contents instead.

I’m not sure if pageType was intended not to work on the AdSense widget but, since this technique helps the relevance of the ads, hopefully no one will complain. If you know a better way to handle this or how to get the pageType attribute to work properly for this widget, leave a comment.

Remove Blog Name from Page Title on Blogger.com for Better SEO

By default, the page title of individual blog posts on Blogger.com begin with the name of the blog. Unless your blog name contains keywords relative to your post, they don’t help the ranking of the page by search engines.

For better search engine optimization (SEO), you want to put the blog name at the end of the title after all the good keywords from the post’s heading text. Siege’s blog, Widget-based, has a nice template hack to fix the page titles. The title of the main page won’t change (it’ll still contain the blog’s name) but the title of individual post pages will place the post’s heading first, followed by the blog’s name.

Adding Links in Blogger for Popular Aggregation and Bookmark Sites

To make it easy for readers to add a blog post from here to link aggregation and bookmarking sites, I’m adding buttons to the Blogger template for each service. To do this on your own Blogger blog, do the following:

  1. Log into Blogger
  2. Click on the Layout tab, then Edit HTML
  3. Select “Expand Widget Templates”
  4. Find the following block of XML (your template may be slightly different)
    <div class='post-body entry-content'>
    <p><data:post.body/></p>
    <div style='clear:both;'/> <!-- clear for photos floats -->
    </div>
  5. Add the following div block immediately after it
    <div style='float:right; margin-left:10px;'>
    <!-- Add button links here -->
    </div>
  6. Add the HTML for any of the sites listed below to the inside of the div block, replacing the line “Add button links here”

    Blinklist

    <a expr:href='"http://blinklist.com/index.php?Action=Blink/addblink.php&url="
    + data:post.url + "&Title=" + data:post.title'>Blinklist</a>

    Del.icio.us

    <a expr:href='"http://del.icio.us/post?url=" + data:post.url + "&title="
    + data:post.title'>Del.icio.us</a>

    Digg

    <a expr:href='"http://digg.com/submit?phase=2&url="
    + data:post.url'>Digg</a>

    Furl

    <a expr:href='"http://furl.net/storeIt.jsp?t=" + data:post.title
    + "&u=" + data:post.url'>Furl</a>

    Reddit

    <a expr:href='"http://reddit.com/submit?url=" + data:post.url
    + "&title=" + data:post.title'>reddit</a>

    Technorati

    <a expr:href='"http://technorati.com/cosmos/search.html?url="
    + data:post.url'>Technorati</a>
  7. Preview the template and, if it looks OK, save it

The icons for each service can be used in place of the link text if desired. Since I don’t want to hot link the images from each service’s site directly, I’m attaching them to this post and referencing them locally (i.e., from Blogger’s server).





Blogger, LiveJournal or WordPress?

Although not new to writing (I’ve edited, contributed to, co-authored, etc. several published books on hardware, software and multimedia in my days), I am new to blogging. So, how did I choose Blogger as my platform? I actually like the features, flexibility, extensibility and control that’s available by hosting my own installation of WordPress, but the following are the main reasons that I started with Blogger:

  1. It’s easy to get started: Like LiveJournal and WordPress.com, Blogger is a service so I can just focus on what I want to write, rather than having to worry about the IT issues of running my own installation of blogging software such as WordPress. [Three-way tie]
  2. It’s free: Yeah, LiveJournal and WordPress (both the hosted WordPress.com and downloaded WordPress) can be used for free although some features cost extra. [Three-way tie, sort of]
  3. I can use my own domain: This is important so that if I choose to use a different blogging solution later with my domain, everyone will still be able to find my blog and all existing links to my posts will still work. LiveJournal and WordPress.com only allow use of a custom domain if you choose one of their paid subscriptions. Blogger includes this feature for free. Alternatively, you can install the WordPress software on your own server and use your own domain but that requires a web host (i.e., more cost and more things to take care of). [Blogger wins]
  4. I can have AdSense ads: Maybe it’s wishful thinking, but it would be nice to generate some income to help pay to have my blog on my own hosted site. With LiveJournal and WordPress.com, this just isn’t an option. [Blogger wins]
  5. Post URLs are SEO-friendly: For better search engine positioning, including words from the post title in the URL is helpful. LiveJournal’s pages use numbered filenames (e.g. exampleblog.livejournal.com/12345.html). [Blogger & WordPress tie]

Thus, from these five criteria, Blogger is ahead by two. Those of you who are more experienced may point out other features that would swing the results differently and I may encounter them as well over time. There’s nothing wrong with that. Different people have different needs. Blogger fulfills my key requirements at this time. Later, my needs will likely change as will the available choices. For now, Blogger leaves me flexibility of choice for when the time for a change arrives.

Happy blogging!