O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  


BLOGGING HACK

"Recent Posts" Sidebar Code for Blogger Basic
A simple code for generating a sequential list of recent posts using permalink URLs for Blogger Basic.

Contributed by:
Lenka Reznicek
[03/11/04 | Discuss (0) | Link to this hack]

I rewrote the Blogger template code between the [blogger][/blogger] tags, and used the permalink URLs to generate links utilizing Blogger's title fields. This code can be placed in the template to sit on your sidebar, and replicates the current posts on your blog, without the timedate or post body (although these could be incorporated as well). There doesn't seem to be a problem using multiple [Blogger][/Blogger] code areas in the template, but try it first in preview.

Here is the prototype code snippet - just replace the '[]' with '<>', and change the font definitions to your taste, or remove the font tags if you're using CSS:

[Blogger]
[font face="Arial, Helvetica, sans-serif" size=1]
[a href="[$BlogItemArchiveFileName$]#[$BlogItemNumber$]"][BlogItemTitle]
[$BlogItemTitle$][a name="[$BlogItemNumber$]"] [/BlogItemTitle][/a]
by [$BlogItemAuthorNickname$]
[/font]
[br]
[/Blogger]

Variations might include omitting the "posted by" reference if only one individual posts on your blog; I used the author nickname field on my group blog, farkleberriesUSA.

One caveat: unless you are using a framed sidebar, try to make sure that the "recent posts" appears lower in the page code than your first instance of [Blogger][/Blogger] tags. Reason? The permalinks will always bring up the first instance of the linked text - if your "recent posts" list appears higher on the page, you may end up viewing the link that appears on the list, rather than the actual post. Also, keep in mind that Blogger basic defines the number (or days) of posts displayed "globally" for your blog - for example, if you set your Blogger formatting to display 7 days' posts per page, only those 7 days of recent posts will show up on your sidebar.

If your Blogger post title includes an URL to an outside page, that URL will also automatically appear in the Recent Posts area, and even multiple links in the title field should work.

-- Lenka Reznicek


O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.