Tuesday, August 23, 2011

Blogger Tips: Creating a page of all your posts with multiple Labels attached to them

First of all, I LOVE the fact that Blogger gives me a total of 10 pages that I can use for customized needs.  When I saw this, I thought it would be a great idea to have a page that shows all the stuff I have for sale. All the post entries have "For Sale" as a Label, so creating this page would be a snap, right?

Wrong.  Very, very wrong.

The 10 pages you get are "static" pages.  In other words, what you key in is all you're going to get, time after time after time.  There is no dynamic function to the page, no way to have it pull up recent posts, or posts with a specific Label.

So I found a simple workaround.  This is nothing new.  I'm not the first to use it, and hopefully once you've read this neat trick, I won't be the last to give it a shot.

If you take a look at my boxy menu towards the top of this blog, you'll see that I have menu items for current auctions, items for sale, and sold items, etc.  These are not links to pages, but rather actual html addresses.  And those addresses point to specific posts I've done, based on the label.

Let's quickly go through this, and maybe things will get a bit clearer.

All my posts that are of my current auctions have the label "Auction" in them.

If my reader clicks on "Auction" in my Label List (which I got rid of since I don't need it anymore), they'll get to a page of all my posts with the label "Auction".  The page's web address will be:

http://www.funkyhomefinds.com/search/label/Auction

Now let's say I want to add a button my readers can click to see all of the current auctions I have running.

I'd go to my Design page, and add an html/javascript widget.

In the content part of the widget, I'd type:

<a href="http://www.funkyhomefinds.com/search/label/Auction"> Click to see my auctions! </a>

When I save it and go to my blog, this little nugget of code gives me a quick link the user can click on to see my auctions!

A simple text link to show all your posts with the Label "Auction"

Want a picture instead of simple text?  Try:

<a href="http://www.funkyhomefinds.com/search/label/Auction" ><img src="
http://i1219.photobucket.com/albums/dd426/funkybydesign/blogcurrentauctionsbutton.png" width="90px" height="90px" /> </a>

This code gives me:

Same functionality, just with an image, rather than text.

OK, most of this probably isn't news.  But for those who want to add a bit more customization and user-friendliness to their blog, it's a great way to let your readers find specific categories of your posts quickly.


Now, here's the really cool part!!

Let's say you have a recipe site (myrecipes.blogspot.com).  And you want to let your readers find all recipes with the label "breakfast".

The web address for the page showing all your posts with the label "breakfast" would be:


<a href="http://myrecipes.blogspot.com/search/label/breakfast"> Click to see my breakfast recipes! </a>

What if you want a page of all your "gluten-free" posts (the posts that have "glutenfree" as a Label)?


<a href="http://myrecipes.blogspot.com/search/label/glutenfree"> Click to see my gluten-free recipes! </a>

BUT...what if you want to let your readers see all posts for breakfast AND are gluten-free?  You have the Label "glutenfree" attached to some of your breakfast, lunch, dinner and snack recipes, and that's a problem, right?

Relax...you can do this.  Check out this code:

<a href=
"http://myrecipes.blogspot.com/search/label/breakfast/label/glutenfree"
> Click to see my gluten-free breakfast recipes! </a>

This little line of code will show your reader all of your posts that have the Label "breakfast" and the Label "glutenfree" associated with them.  Cool, huh? 

Now...a word of warning.  Nothing serious, just something you need to be careful about.

See anything different about this line?


<a href=
"http://myrecipes.blogspot.com/search/label/breakfast/label/Glutenfree"
> Click to see my gluten-free breakfast recipes! </a>
 

It's almost identical to the one above, but this one won't work.  In fact, it won't bring up any posts at all!!!

Why?  Because of one letter.  See "Glutenfree"?  This is looking for the label "Glutenfree" but your posts have "glutenfree".  That little capital "G" is all that's needed to mess things up for you.  Remember:  label searches are very case-sensitive.

Hope this helps at least someone out there.  Remember, a bit of customization on your blog to let your readers find specific posts is a great way to:
  • help your readers get to the content they want
  • let your readers avoid content they aren't interested in, and
  • keep your readers on your site longer
Good luck!  And have fun!


Was this post helpful?  Leave me a quick comment below to let me know what you thought.


No comments:

Post a Comment