New Links To Old Content

by Josh on April 17, 2006 · 5 comments

in Journal

I recently fixed a problem with the blog that has bothered me for months. This may be of interest to other housebloggers, particularly those using Blogsome.

The issue is how to handle the “number of posts/days per page” setting; for Blogsome, this is in the option menu. This setting applies to all pages on the blog, including monthly archives, categories, and the main page. I wanted to keep the posts per page setting small (5 posts) so that the main page of the blog would be clean, compact, and quick-loading. But with only five posts per page, someone who clicked on the monthly archive for March 2006 could only see the last five posts instead of all eleven for that particular month.

The solution? Add a small bit of code that creates “previous posts” and “next posts” links at the bottom of the page. With this feature enabled, any group of posts that is too numerous to fit on one page (>5) now flows to as many additional pages as necessary.

To set this up, you just add a line or two of code beneath {the_content} on your main page in Blogsome’s manage menu. I created links to allow navigation from each individual post to the next or previous as well.

Here’s the basic code that I put in the “Posts” html file under {the_content}wherever you want the links:

{previous_post_link format="Previous: %title"}
{next_post_link format="Next: %title"}

And here’s the code that goes on the “Main Site Sheet” right under {content}:

{next_posts_link label = "Previous Posts"}
{previous_posts_link label = "Next Posts"}

If you want to control the appearance of these links, you will also need to add a div or class for these links to your site style sheet. A couple places that talk about how to add and format these links are the Blogsome Forum, and Paint the Tiger / Carve the Swan.

So, Salvaged Beauty, Ranch Redo, or anyone else, I hope this tip is helpful– and I hope the code works for you.

{ 5 comments… read them below or add one }

Shauna April 17, 2006 at 7:08 pm

Thanks for the tips!
What I really want to know is how you summarize with the “continue reading” on your main page EXCEPT the most recent post. I tend to refrain from using the ‘more’ tag – but only because I have to wrap it in a class tag within the ‘write post’ window or it looks like crap. CSS is still a bit of a pain in the *ss for me (I’m sure there’s a way to style it with CSS, but I’ve found the theme I started with leaves a lot to be desired – and didn’t validate in the first place). I do know how to change the text of the ‘more’ tag. Just wondering what else you did to get your main page to work that way…or are you manually editing the previous post each time you add a new one?

I also see you’re using that new spam thingy on your comments – how’s that working for you? I disabled Kitten’s Spaminator because it wouldn’t let me leave a comment on my own blog. Now I’m getting a lot of spam (manually deleting the suckers).
Would love to see your main.html and posts.html as text files to do some examining (because you get a bastardized version if you just click on ‘view source’).
Your blog is rockin’ (as always). Love the new icon, too.

Reply

Shauna April 17, 2006 at 7:22 pm

Whoa – just noticed you’re calling the titles of previous posts, too! I’ve been trying to figure that out, but with no luck (saw something about it in the Wordpress Codex, but couldn’t get it to work under Blogsome with its stupid smarty tags).
Impressive. I must have the secret code…name your price..left arm, first born, Home Depot gift card???

Reply

Laurie April 18, 2006 at 12:11 am

Hallelujiah!! I’ve been struggling the last two weeks ‘cause I just couln’t figure out how to make my pages shorter…becuase if I include 30 days, the page gets all screwed up as you scroll down. This solves all my problems!!

Reply

Josh April 17, 2006 at 8:32 pm

You got it, Shauna. I’ll send you text files of my “main” and “posts” — I’ll even throw in the style sheet as a bonus.

As for the summaries on the main page, they’re done as you suspect with the “more…” tag. Until I find a more elegant way to do this, I am now in the habit of adding a “more…” to my number 2 post whenever I post something new. (If you dig back far enough, you’ll find old posts with no “more…” yet.)

The new anti-spam captcha seems to work great. I used to get a few bits of comment spam every day, but I’ve only had one since I installed the in-form captcha.

Re: the new icon, what can I say, I finally found a use for MS Paint. :) I really liked the icon you made for me, Shauna, and still appreciate your tip about how to publish it for the browser address bar. So, you can keep that left arm– I’m just happy to return the favor.

Reply

Josh April 18, 2006 at 12:21 pm

Glad to help, Laurie!

Reply

Leave a Comment

Previous post:

Next post: