August 13, 2006

Related posts from your blog

Few people had expressed interest in finding related posts from their blog automatically. If you have lot of posts in archives, it is indeed difficult to find the ones that are related to the current post.

By tweaking my previous hack to display related posts from Blogosphere, I have come up with another version to do this. This time, I have tweaked it to bring out only the relevant posts or None. I use the "Search in title" operation in Google blogsearch to find the earlier posts with titles that have atleast 2 non-trivial words from the current post's title. I hope this will encourage more people to try this hack.

For plugging-in this feature to your blog, add the following piece of code after the <$BlogItemBody$> tag.


<ItemPage>
<script language="Javascript"
src="http://www.anniyalogam.com/scripts/relatedposts-blog.php?
url=<$BlogItemPermalinkUrl$>&blog=<$BlogURL$>">
</script>
</ItemPage>


This will display the related posts right after the Post body as you see below (only in post pages). Please note that it won't display anything if there are no related posts. You could also place in any other location in your template that you like to.

9 comments:

Khong Co Ai said...

Thanks a lot for this hack, i was looking for it since 1 year. :)

Now we miss just one extention of this hack....: "Related video"

Thanks in advance Ramani ^^

KCA

Loup Dargent said...

D'oh! I keep getting this message:

"Please correct the error below, and submit your template again.
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The value of attribute "src" associated with an element type "script" must not contain the '<' character. "

Any suggestions?

Thanks in advance.

Loup

KrisUnderwood said...

How do you do related posts in blogger beta?

Ramani said...

Kris,

I haven't yet got this working in Beta. I will see if I can.

raj said...

this might work in new blogger
put this data:post.urlat the place of
$BlogItemPermalinkUrl$

Patricia Ramírez said...

is possible change de words related posts by others???

I have a blog in spanish :)

Thanks

Nospheratt said...

Hi, Ramani. I love your blog, you're a genius! Thank you so much for all your hacks!

I've translated this hack to Portuguese, here:

Hack de Posts Recentes para Blogger Clássico

My readers have been asking for this, and thanks to you, I can help them. Obrigada! :)

I'l be translating some other hacks and I'll let you know about them.

Once again, thanks, thanks, thanks!
A big hug for you, from a Brazilian girl!

Joana Morais said...

Hi Ramani,
I was wondering if your going to update this hack, or if there's a way
to use it with the new blogger? thank you

Ramani said...

Joana,

I don't think I will make this hack work with new Blogger. If I ever do, I will announce it in my blog. Just subscribe to my feed.