« Add a Free Forum to Your TypePad Blog in Minutes! | Main | Lots of New Feature Rollouts for TypePad »

John T. Unger

Add Links to Recent Posts on Your Individual Entries

John T. Unger May 25, 2007

Kevin C. Tofel wrote me this morning to share a cool hack he had come up with which he hopes will make his blog stickier for people who discover individual entries through search. He wrote:

Kevin_c_tofel I was looking for a way to reduce the bounce rate on our site jkontherun.com. I wanted to have the five most recent posts as links underneath posts from the Individual archives. It's easy to do this on any other Index page, but not on the Individual one because it can't handle multiple <MTEntries> containers. The trick is to use a virtual include.

I've provided Kevin's instructions in the extended post, but first, a caveat: I've heard that includes may not be supported in future versions of TypePad. I assume that they won't be disappearing until there's a new function to achieve the same goals. For now, they work fine, and this might be just the trick some of you are looking for to help people who have just discovered your blog to explore a bit more deeply. To see an example of how this hack looks, visit any of Kevin's individual entries, for example, today's post. Links on your blog will inherit the style you've defined for list items and links.

Here's how Kevin created the listing for recent posts under his permanent entries:

  1. Log in to TypePad and go to the Design tab for the advanced template blog where you'll be adding the links.
  2. Click on Create new index template. You can name it whatever you like in the Template Name field. In the Output File field, type recentposts.inc.
  3. Add the following code to the Template Body field:

    <MTEntries lastn="5"><ul>
    <li><a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a></li></ul>

    (Note: You might want to paste this code into a text-only editor first to make sure that rich text characters don't mess up your template).
  4. You can change the number from 5 if you would like more or fewer posts to list.
  5. Click Save.
  6. Now, go to your entry-individual template (if you don't see a template named entry-individual, see my recent post: 3 Custom Template Modules You'll Use Again and Again). Add the following include code to your template between the post content and the comments code:

    <!--#include virtual="/<$MTBlogDirname$>/recentposts.inc"-->
  7. Click Save.
  8. Publish your index pages (the default setting when you edit modules or archives is Publish All Files, but it's much quicker if you select Publish Indexes Only).

Bonus: if you'd like to define the look of the links to recent posts to display differently than other links or list items on your blog, you can define a custom look for them in CSS and apply the style to the links in your recentposts.inc template.

More Like This: Advanced Templates , Hacks for Navigation

Tags: , , ,


James Taylor says:

I had to edit it slightly for it to work but it's great. I moved the ul and /ul outside the MTEntries and put li and /li around the links. I also included the link to subscribe to the feed as I thought that was a good idea too.

Rodrigo Hernandes says:

Bem vindo !!!Guia de sites web com os links da maioria dos antivirus do mercado. Quer adicionar seu link ? Em breve um jogo de Libras / Português

Ricky Cadden says:

How easy would this be to change from "recent" posts to "related" posts by keyword lookup or otherwise?

john t unger says:

Hi Ricky,

It seems like that would definitely be a more useful feature, actually.

I'm not sure if that would work or not, but it seems like it might be possible. Two ways that come to mind are looking at the code used in the footer to display categories, or maybe using a category specific RSS feed limited to a certain number of entries. There's things that could be done with an MTInclude file also.

I'll play around with it when I get a chance… In the mean time, if you want to hack at it, let me know what you find out!

Ricky Cadden says:

I'll have some time later this week. That's actually a big reason I'm mulling moving my blog to Wordpress, as I think relevant entries is a great way to keep older stuff from getting stale.

Darla says:

I agree that Ricky's idea would be much more useful. But it seems that it might be a matter of inputting a keyword specific field.

Simon says:

I'm playing with a widget called Jiglu which looks like it has great potential for related site searches. It's awfully brand-heavy at the mo, but with persuasion i reckon it could be a massive help in stickiness.

Peter says:

Hi Guys

I am implementing this on my blog and just having trouble with the class to have it display to conform with my CSS.

Sory I am a newbie this one has been doing my head in for a couple of hours. Would appreciate if you could help!

Here is the code just want to insert the class behaviour in the right spot!

Many thanks Peter

olivia says:

Ricky or John - did either of you figure out how to link up the related posts?

Nancy says:

Ditto to olivia's comment -- did anyone figure out how to link up to Related Posts? It'd be such a useful feature!

Nancy says:

Ditto to olivia's comment -- did anyone figure out how to link up to Related Posts? It'd be such a useful feature!

John T Unger says:

Olivia and Ricky,

You can use Feedjit's widget (as seen at the bottom of my sidebar) to display related posts. It works on a page specific basis in the sidebar, or you could add it to the bottom of each post.


The comments to this entry are closed.


TrackBack URL for this entry:

Listed below are links to weblogs that reference Add Links to Recent Posts on Your Individual Entries:

typepad hacks is a typepad featured weblog typepad hacks is listed on Alltop social media


Email RSS Comments  
Subscribe to TypePad Hacks with email Read TypePad Hacks posts via RSS Join the conversation at TypePad Hacks via RSS (comments feed) subscriber count



Twitter Logo
    follow typepadhacks on twitter

    Read and reply to the 100 most recent comments at the TypePad Hacks Community Page



    Powered by TypePad
    Member since 03/2005

    TypePad Status

    Creative Commons License