Blogger Hacks, Categories, Tips & Tricks

Tuesday, August 09, 2005
Clickable post titles in blogger...
In response to a comment from GodsDragon, here's some thoughts on how, why & when to make your blogger post titles clickable.

Two sets of tags that we're messing with here. blogitemtitle and itempage / mainpage. To start with the last ones, blogger calls these conditional tags & they govern which parts of your template are displayed on main & post pages. You can wrap certain elements of your template in these tags to force them to display conditionally.

As for blogitemtitle, clickable blog post titles seem to be a feature of the newer default blogger templates that I've messed with, but if you're old-school, or using a special template from blogskins, for example, then your titles won't click. All these edits are for code between the blogger tags. Specifically we're going to replace the blogitemtitle tags, and add some extra stuff between them. Please back up your templates first!!

Here's 3 reasons to make your post title clickable, & 3 ways to do it if you'd like to add the feature:

1: Make the post title click back to your main page.

Why? I don't know really. Some sort of home link from in-post is useful, but I don't think a reader will expect your post title to be it. Anyway....

<BlogItemTitle><span class="PostTitle">
<a href="<$BlogURL$>">

If you want this to only work on the permalink post page, wrap both the opening link tag & the closing a-tag in itempage tags, like this:

<BlogItemTitle><span class="PostTitle">
<itempage><a href="<$BlogURL$>"></itempage>

2: Make the post title the permalink.

More useful, esp to jump off the main page to the post page. For this one...

<BlogItemTitle><span class="PostTitle">
<a href="<$BlogItemPermalinkURL$>">

For clickable titles on every page, just replace the existing blogitemtitle code with the snippet above.

If you want this to only work on the main page
, wrap both the entire opening link tag & the closing a-tag in mainpage tags. You need 2 seperate sets of these tags, because if you include <$BlogItemTitle$> in the wrap, your title won't show on the post page. The solution? Leave the existing non-clickable post title in your template, wrapped in itempage tags, & add the above code to your template wrapped in mainorarchivepage tags.

3: Make the post title link offsite to whatever link you put in your link field.

This makes use of the <BlogItemURL> tags. Podcast? Link to offsite media? If your post title is "Dave's Show #3: The Spielberg Interview" then you'll want to link to the MP-3 from your title field, I guess. First enable the link field in your blogger settings. [dashboard > settings > formatting]. If you want the link to appear in the body or footer of your post, you'll have to add blogitem code to your template:

<a href="<$BlogItemURL$>">Link</a>

If you want the link to appear as your post title, you can combine blogitemURL and blogitemtitle tags as follows:

<span class="post-title">
<BlogItemUrl><a href="<$BlogItemUrl$>" title="external link"></BlogItemUrl>

making clickable titles that point to the link you specify in the link field.

A combination of 1 & 2 ought to be possible too, using item page and main page tags. Make the title the permalink off the main page, & the link back home from the post page. Try this:

<BlogItemTitle><span class="PostTitle">
<itempage><a href="<$BlogURL$>"><$BlogItemTitle$></a></itempage>
<mainpage><a href="<$BlogItemPermalinkUrl$>" title="permanent link"><$BlogItemTitle$></a></mainpage>

Hope these are useful edits for you. I may even roll something out at Freshblog!! Code, of course, made visible by the fine people at Centricle.

See other posts in Blogger Hacks: The Series

Posted at 10:49 AM by John.
<    >
Blogger Id.Ology said...
Thanks john. I'm reading on this one!

<    >
Blogger Id.Ology said...
Oh,john your ideas work like charm. It works!I'm not wrong to say your work is blogspot bible.
You know what,I'm going to write a post in my blog to praise your work, urge all the readers who come to my blog to worship your work.
cause everbody said blogspot is crap, worse than moveable type,worse than wordpress. Whatsoever. Some even said the bloggers from third world have no choice but to suffer the lack of features from blogspot cause they have no money to change to better typepad or blogware etc. The only thing they don't know is the great works of yours.I feel obliged to clear the blind point of knowledge. Spread your works, be a missionary.
But I still own you a 'Thanks'.

<    >
Blogger Id.Ology said...
John I just publish my post about your blogspot bible! Have a look!
There are tens million blogspot bloggers suffering lack of features whatsoever.
The need for your work must be huge. I think as times goes on, one day you can edit the works into a book'blogspot bible' published. I can see a huge market potential for this book. It's gonna be huge.

<    >
Just passing through, I'm liking the blog by the way.

<    >
Blogger A said...
hey john i wanted to ask you if the blogger code for add the automatic link in every post to furl and delicious is done the same way you add the metacosmos one?

if not could you tell me how exactly?

<    >
Blogger titanium said...
cool site. I worked out a similar blogger link hack and posted it here:

blogger link hack

<    >
Blogger Miss Eagle said...
I'm dumb. I don't seem to have a handle on this. My blogger template has been in use only a couple of months. The title on the post is not clickable unless I use a hyperlink to link it to something else I'm talking about. I don't understand what a permalink is and I don't seem to have one of these either. Please explain? I use lots of hyperlinks in my posts - along the lines of Wikipedia so that I provide information along with opinion.

<    >
Blogger Ron said...
Hi John, it's the Dutchman again.

I want clickable headers (Option 2?) but I can't figure out how to do it. As I read through option 2 my mind gets messed up. Is it correct what's been written?? Do I need 2 sections with the same code?? Where to put it?? To many questions for me.

thx Ron

<    >
Blogger John said...

There was an error in the formatting of section 2 that I didn't see. I have fixed it & hopefully clarified the hack as well. I've answered your question there, but to answer it here too... You only need 2 sets of tags if you want the titles to behave differently on post & main pages. If you don't care that they're clickable on all pages (like mine) then just do a straight swap of the section 2 code for your existing blogitemtitle code. Hope this helps. Thanks for finding the error. All fixed now.

<    >
Blogger Jonathan Fung said...
Hey, I'm using this code, but I'm still having a problem. When the titles mouseover, they don't seem to follow the mouseover styles that the rest of the page follows. If you can help me solve this problem, please drop me a line on my blog. Thanks!

<    >
Blogger Kuku said...
Thanks a lot John. I had some trouble with the snippet provided on the blogger help pages and that absolutely didn't work. I use FTP publishing and I thought that was the problem. Now its working like a charm although it has messed up the alink-hover CSS. Somehow a background color appears upon mouse-over though none of the other links on the page follows that pattern.

At least now I have a permalink for each post title. Thanks again.


<    >
Blogger Bloggers said...
Thanks so much for this. I had been working on my blog and changed the template , which I had to do in classic mode and could no get my titles clickable , until I found this , now they are clickable again and we are all happy.

<    >
Blogger Glowmay said...
Oh, wow. Brilliant. Thanks.

<    >
Thanks a lot John, after several hours of searching, you had the info I was looking for!

<    >
Blogger Evolution said...
Thanks for all the great tips John. In section 2 How would I go about chaging the font size and color for the now clickable post titles. The titles now look like all the links in the body of text within posts. Thanks again.

<    >
Anonymous jb said...
ummm I need help regarding this topic, I can't seem to make my title post clickable, how do I put the code? & what code do I need? please I need help.

Links to this post:

Create a Link

eXTReMe Tracker