home
March 09, 2004
"Recent Posts" HTML Code for Blogger Basic 
 
This is a strange story. At about 3:00 this morning I awoke with a headache and heartburn. Normally, my first instinct would be to stroll into the bathroom, prepare an Alka-Seltzer, and go back to sleep. Not last night, I woke up and I had a wild idea about blogging.

Before you say, "Lenka, get a life!" - it occurred to me that there should be a simple means of generating Blogger™ code to create a list of recent posts, including titles and links to the posts. Then it hit me, like five-alarm chili: the code was already there, in the template. It just needed some tweaking.

I rewrote the Blogger template code between the [blogger][/blogger] tags, and used the permalink URLs to generate links utilizing Blogger's current title fields. This new "mini-post" 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 I am sure these could be incorporated somehow as well). There doesn't seem to be a problem using two [Blogger][/Blogger] code areas in the template, but try it first in preview for yourself. The result can be seen on the sidebar - click on any title, and you are instantly taken to that post. 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.

Other than that, it seems to work fine! Let me know what you think!!

posted by Lenka Reznicek  [link] | |

 
headlines
 Atom Syndication

March 09, 2004
"Recent Posts" HTML Code for Blogger Basic by Lenka Reznicek

contributors

















archives

credits
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial 3.0 License.

webdesign based on a template from maystar designs
adapted by farkleberries
powered by blogger

Weblog Commenting and Trackback by HaloScan.com


 

original code and template by maystar designs copyright 2003