Table of Contents

A little while ago I thought it would be nice to have a Table of Contents on my Blog. So I experimented a bit on how this could be done without a lot of hacking, and also without outside help such as del.icio.us.

Ramani has some interesting hacks, and 2 of them I combined into a new one.

If you want to list all your posts in one page, you can use the following url:
http://yourblog/search/label/?max-results=100
Is it as simple as that?
Yes it is!
The max-results is limited to 100 results. This is a Blogger server-side restriction. So it will give a TOC for only the 100 latest posts.

If we want to display only post titles we have to do a little more hacking, but Ramani has explained how to do this on archive pages. I just applied this to label pages.

Edit your template, find the Blog widget, and replace the entire main-includable with this txt-file. Save your template.

Add the url to a convenient place in your menubar or sidebar, and ready you are.

This is what people say:

annie said...

Hans, the link for the txt file is a dead end. :-(

Hans said...

Annie, a typo. Fixed it now.

Ramani said...

Hans,

I had also improved this hack to expand/collapse the posts with a +/- so that all the posts are viewable from the same page.

http://hackosphere.blogspot.com/2006/09/peek-boo-view-of-posts-in-label-pages.html

This was the first peekaboo hack that I implemented before peekaboo posts with summary.

annie said...

I love it! Works wonderfully. I posted about it on my blog, with more detail on implementing it for those that may have problems with hacking their template.

Thanks Hans.

Brainiac said...

Any Question, The template does not let to me put more widgets (4 in sidebar left and 1 in right) I want to put more (feeds, etc,) that I do?

Pete said...

Just a quick note that max-results has as server-enforced limit of 100.

And, just so you're not surprised, editing an old post will cause it to jump up in the listing, since the Atom feed is sorted by updated time, not published time.

Hans said...

@ramani:I wanted to try it out with a simple version first. I want to implement the expandable version later.

@annie: glad you like it, and excellent explanation on your Blog!

@braniac: It might have to do with the maxwidgets-setting of the sidebar section.

@Pete: thanks for the info. Is there another way to list all post titles without a 100 limit restriction? Most Blogs might exceed 100 posts sooner or later.

Alice said...

Hi Hans

I linked to this hack here
http://cmbs.cnc.net/blogtemplates/bloggerinst.html#photoblogideas

Thanks :)

Hans said...

@Alice: you are welcome!

Ron said...

Do you know how to make a drop down window for the items in a sidebar? I'm not well versed in HTML so if it requires HTML just tell me where it goes.
Thanks
Ron

Askedweb said...

Hans, this hacking is wery good for me. Thank you for good work!

I had also little improved this hack to archives and add style to displayed content.

If it may be interest to any to see at http://docs.google.com/View?docid=dx9ktkm_9c99kj7

Southern Writer said...

Ah, now I remember the other hack I tried (along with the one for creating a table of contents). It was the one for opening links in a new window.

I'm an astrologer, and sometimes when I'm writing or talking about planets, aspects, angles, etc., people look at me like, "What the f**k are you talking about?" Now I know how they feel. Guess I'll leave the hacks until my brain is functioning better. :(

Giriraj Joshi said...

Hi Hans,

Its too good. it Works wonderfully. I am an Indian Blogger, May I post about it on my blog in INDIAN Language HINDI?

I m facing problem to arrange it in Tabular format and don't know how to sort by TITLE, DATE etc...

Plz help me about this and give me permit to translate ur post in HINDI.

Thanx a lot.

:: Suzanne :: said...

hello. I use your widgets all over the place. When I implemented the TOC widget, it changed my tag cloud. When clicking on a tag in my tag cloud, we used to get a page with all the actual posts for that tag. Now we get a list of post titles. Any advice?

Thanks again for all you do for us.

Best,

Suzanne
http://www.adventuresindailyliving.blogspot.com

O Embaixador said...

Sorry Hans, het werkt niet :(

O Embaixador said...

Het werkt nu wel, ik heb de handleiding van Blog U gevolgd en het is perfect! Bedankt.

ccrv said...

Hi Hans,
congratulations for your great works... you're a guru for bloggers
I'd like to add a table of contents (like yours, my blog (http://1001juegos.blogspot.com)have a lot of games entries, I pasted the includable but it doesn't work ¿can you be more explicit with the url and other extremes, please?
Be patience with newbies
Thanks

Guiom said...

Is it me or does it work only on blogs hosted @ ".blogspot.com" ?

It doesn't work with my blog... Too sad... Any help much appreciated !

ROSIDAH said...

Thanks for this great widget, Hans :)!