Wednesday, November 09, 2005

Blogger Tags and Categories: How To

Ok, well since my last post I've spent a good few hours trawling the internet for ways to get around the fact that Blogger doesn't allow you to post categories, and there are a few complex ones, a few easier ones, but I've come up with a way that suits me. I'm not saying it's going to be the easiest for everyone, just me, but hey you never know, someone somewhere might find this useful!

There are 3 stages;
  • setting it up
  • adding tags to posts
  • setting up categories


Stage 1: Set Up

Firstly you need to set up a new account at del.icio.us. It needs to be a fresh new account with no bookmarks in already, so that you can use it only to bookmark pages from your Blogger blog.

Secondly you need to edit your Blog's template, and include the javascript for FreshBlog's one click posting to del.icio.us into the .post section of the template. I added mine straight after the "show links to this post", so it fits into the post actions section quite well, but you can put it wherever you like as long as it is attached to each individual post you make.

The code to include here is the following:



<!--begin post to del.icio.us-->
<a href="http://del.icio.us/post?url=<$BlogItemPermalinkUrl$>
&title=<$BlogTitle$>: <$BlogItemTitle$>" target="_blank">to Del.icio.us</a>
<!--end post to del.icio.us-->

Stage 2: Adding Tags To Posts

The next thing you need to do is to add tags to your posts, once you re-publish your blog (not just the index) you can send every post to del.icio.us by clicking on the link you just created in each post, and then you can add a few tags for each post you've made, and of course this will work on every new post you make as well. **

So now in your del.icio.us account you will have different categories/tags with your posts indexed, which is basically what you want on your blog, the next stage is to put this information into your blog and make it look as if it's a part of your blog, rather than an external website, this we can do in the next stage.

Stage 3: Setting Up Categories

There are 2 things you now need to do, firstly you need to set up a page which shows each category and lists the posts which fall under the category, and then you need to place a category link into your sidebar.

Stage 3a: Category Pages

I took an idea that Pappmaskin uses in his blog, and used the feed from each del.icio.us tag to create a page for each category.

It may be quite long winded to set up, but you only have to do this once for every new category you want to install, once you set up a category page then it will update automatically whenever you send a new post to del.icio.us and ass the same tag.

Firstly, go to your del.icio.us account, and click on the tag that you want to make into a blog category. At the bottom of the page there is a link to the RSS feed for that link, copy that address to your clipboard.

Second, create a javascript from the RSS code by going to Feed2 JS here, and entering the RSS code you just copied to your clipboard. This will give you a javascript code which you can put into your Blog as a new entry.

Third, in your Blogger, create a new post and click on the "Edit HTML" option, and paste the javascript code, give it a title and press Publish Post. You might also want to set the date into the past so it doesn't come up at the front of your blog confusing the hell out of everyone.

It will tell you that your code isn't valid, but ignore it and click on the Stop showing errors for this post option and press Publish Post again.

Hopefully this post will now list all of your posts which fall under this category, the next thing to do of course is to add a link to it in your sidebar so people can actually access your categories, making all this effort somewhat worth it!

Stage 3b: Sidebar Section

This bit is pretty easy, in your template locate the sidebar section of code, and write a section for your category links to go, then create a list of your categories and link each post that you just created in the last section, easy as.



I know this all seems very long winded, but really at the end of the day, you only have to add a new page and link each time you create a new category, so once you've done this and set up all of your categories then you only have to do stage 2 every time you post, which takes 20 seconds max, del.icio.us even suggests old tag names so you don't even have to remember which tags you've used in the past, which is awesome.


notes:

** For those not familiar with del.icio.us it is a bookmarking site where people can browse the favourite websites of other users, adding tags to the web pages that you send to the site is like putting blog posts into categories, so you can group things together and find websites by category or keyword, and because you can group every website under as many categories as you want this is what we will use for our categories in our blog, because we will only have our blog pages indexed here.

3 Comments:

Blogger m. said...

Cool stuff! I'm to lazy to post everything to del.icio.us, so I just use the blogger search. I dont know if you noticed but I added a javascript that builds that other script (sort of) so i don't have to create a new post for each category (as I said, I'm lazy).

Like so!
http://pappmaskin.blogspot.com/2005/10/blogger-categories.html?tag=ipod

Many of my posts are just links to stuff I've found that I need for reference later, not neccesarily something that should "clutter up" del.icio.us, but I would love to later have the possibility to cross publish to del.icio.us when I add my tags, perhaps something like xmlhttprequest ??? If anyone over at del.icio.us reads this, please start thinking about something like that!

Since you wrote this post I've also changed the Filed in-link on my (new) posts, you can see it in action on http://pappmaskin.blogspot.com/2005/11/jeffpipascom-ajax-form-processor.html

I did a test on this a month or so ago but it seemed like the tags/posts didn't show up in Technorati, so I dropped the idea of not pointing there or to del.ciou.us, but when I tried it again yesterday the post showed up in technorati after a manual ping, so no reason to point to del.ciou.us , unless you want to.

I've added your to del.icio.us link, thats a cool one, will republish all posts soon, it's a great feature even if I don't use del.icio.us for my categories.

November 25, 2005 1:03 PM  
Blogger Team Member Sven said...

Hey thanks for the tutorial. Everything is working fine except I can only get one of the things that I tag to come up under that category. So if I have 3 thigns under Humor only one comes up.

thanks in advance
SV

November 26, 2005 6:39 PM  
Blogger Greg said...

I was wondering if you've seen FreshTags?

It will let you use your delicious account to set up permanent categories on your blog. (But if it doesn't do something you need to do, I'd love to hear from you.)

January 17, 2006 5:08 PM  

Post a Comment

Links to this post:

Create a Link

<< Home