Here is how to install it to your Blog.
Step 1: Back Up your Template.
Step 2: Add a HTML Page Element
Edit your template in HTML-mode, and look for the <b:section> with id=main. This is the section that holds the Blog posts.
Change that line as follows:
<b:section class='main' id='main' maxwidgets='2' showaddelement='yes'>
Save the template and switch to the Page Elements Tab.
Add a HTML page element above your Blog Posts element.
Leave the title blank. Add the following html:
<div id="toc"></div>
Save your template.
Step 3: Add a Sidebar HTML-element
Now add a HTML-element to the sidebar. Set the title to "TOC".
For the contents, enter:
<div id="toclink"><a href="javascript:showToc();">Show TOC</a><br/><br/></div>
<script style="text/javascript" src="http://kpn.planet.nl/oosti468/downloads/blogtoc.js"></script>
<script src="http://YOURBLOG.blogspot.com/feeds/posts/default?alt=json-in-script&max-results=999&callback=loadtoc"></script>
Replace YOURBLOG with the name of ...... exactly.
Oh yes, and save.
Step 4: Add custom styles to the skin of your template.
New id's and classes are:
#toc : the div-wrapper that contains the TOC
.toc-header-col1 : header of column 1
.toc-header-col2 : header of column 2
.toc-header-col3 : header of column 3
.toc-entry-col1 : cell in column 1
.toc-entry-col2 : cell in column 2
.toc-entry-col3 : cell in column 3
For your convenience: Beautiful Beta uses the following styling:
<style type="text/css">
#toc {
border: 0px solid #000000;
background: #ffffff;
padding: 5px;
width:500px;
margin-top:10px;
}
.toc-header-col1, .toc-header-col2, .toc-header-col3 {
background: #ffd595;
color: #000000;
padding-left: 5px;
width:250px;
}
.toc-header-col2 {
width:75px;
}
.toc-header-col3 {
width:125px;
}
.toc-header-col1 a:link, .toc-header-col1 a:visited, .toc-header-col2 a:link, .toc-header-col2 a:visited, .toc-header-col3 a:link, .toc-header-col3 a:visited {
font-size:80%;
text-decoration:none;
}
.toc-header-col1 a:hover, .toc-header-col2 a:hover, .toc-header-col3 a:hover {
font-size:80%;
text-decoration:underline;
}
.toc-entry-col1, .toc-entry-col2, .toc-entry-col3 {
padding-left: 5px;
font-size:70%;
}
</style>
You can add this to the <b:skin>-part of the template, or insert it in the sidebar widget.
Enjoy!

This is what people say:
So I implemented it.
Thanks muchness again ^^
So, Hans, does this over-ride the 100 post limit? Please say yes!!
This is beautiful and I have already implenented at www.planetabell.com.
Is it possible to customize so that "Show TOC / Hide TOC" says something else ("Show Table of Contents / Hide Table of Contents")
It is a small point but I'm not sure "TOC" will be understood by the average reader.
This is a great hack for Blogger. I had implemented it in my blog. Thank you Hans.
Dear Hans,
All i want is that visiting label page should show label titles like it happens in your blog, how to achieve that?
Regards, Rohit
GREAT! :D. I`ve done it.
(You`re a genius!. Congratulations!)
Hi Hans,
There's one bug that i came across after implementing your hack on my blog. it is regarding the labels column. once we click any label to list all the posts with that label, we can't get the whole TOC back - unless we reload the page. i.e., even after clicking 'Hide TOC' and again clicking 'Show TOC' - it lists only the posts with last label clicked and not all posts on my blog.
Hope u'll look into this and come up with a cure for this.
@Annie: No, the 100-post issue is not yet resolved. Main problem is that my blog has less than 100 issues, so can't test anything. And I have not yet solved the "how do I do that" question (but have some ideas). This will have to wait a bit.
@John: I will put that on the to-do-list. In the meantime, you can use a clear header for the sidebar element (Table of Contents), and you can also add some explanatory text there, telling your user to click the link etc.).
@bikram: click the label column header to reset the filter and show all posts again. No need to refresh the page.
I cant thank you enough. The styles you provided are great great great and luckily they fit perfectly to my blog. Can anything be done to keep the list sorted by date as a default?
@Basketer: that will go on the list too. Right now I am trying to break through the 100 posts-limit.
Amazing¡¡¡ i love this widget, especially the label filtering¡¡¡
Thanks a lot¡¡
Dear Hans, amazing hacks ^_^
BTW, I installed this hack in my Blog,but there is a bug when clicking "javascript" labels in my blog, the listing post title isn't correct!
It shows "Displaying 140 posts labeled 'javascript' of 162 posts total", in fact there is only 10 post labeled 'javascript' in my Blog, I can't figure out where the problem is, cause clicking other labels won't get any wrong number.
i want to use this hack on chinese blog ,but it seems some note in you JS can't be chinese word.
for example: post title --- 文章标题
but if changed in js ,it will be SHOWS: %#%#%^#%#% at blog...
can you make the hack can be customed?
Fantastic hack! Thanks again.
I've translated it to spanish. The new version is available in http://tomatmus.googlepages.com/blogtoc_SP.js
Further suggestions:
- show blog title in header of ToC
- use this hack in the same blog for more than one blog
The only problem I've noticed is the interference in IE with gif animation and background music, as I mentioned with peek-a boo hack.
I've seen also differences with the resume of posts that appears passing the mouse: with IE they are longer than with FF ¿is a problem of the hack or config of my FF?
Hi Hans,
Thanks for another great widgets,
I utilized it and create a small code to search on lables, I believe this will solve some problem of 'thousand labels' issue.
You might want to give it a try :)
It works perfectly with your TOC
<form action="#" name="label_search">
<input onkeyup=" javascript:filterPosts(document.label_search.target.value)"
name="target" type="TEXT"/>
</form>
Thanks again !
http://nightflight999.blogspot.com/2007/04/searchable-blogger-labels.html
David
@gg
I am using Chinese as well, but the program works without any problem.
you can check it out on my site.
http://nightflight999.blogspot.com/
@月夜天翔 :you totally don't understand what i mean!!!!
can you make you blog this hack:
Displaying all 21 posts
POST TITLE POST DATE LABELS
be chinese?please see more careful before you say so!!!
nice....
thank you hans..
nice...
thank you hans
Hi Hans!
I've stumbled upon your blogger hack today and integrated it in my blog. Made a few changes, but I'm still in the process of using DIV tags instead of table tags.
Nicely done!
Tadam! A Table of Contents (ToC) as I have never seen it before!
This new trick from the wizard of widgets is real magic. Thanks Hans! I really enjoy this new kind of table of contents. I’m totally in awe in front of my computer when I contemplate the interplay between the various zoom in and zoom out possibilities. Now I can explore and manage the contents of my blog in a single place without long loading of pages. I have translated to French the various informational texts in the blogtoc file. Thanks for all the explanations inside your file. I really appreciate discovering the logics behind such a hack. Your instructions make me enjoyed the discovery even if my programming knowledge is very limited. Finally, thanks for making obvious the “New id's and classes” and for providing a styling example.
Question about step 2:
—maxwidgets='2' showaddelement='yes' — Is there a special reason for adding this extra line of code? I’m using other widgets on the main page of my blog and if I add your code I experience various kinds of limits to manage my widgets. The ToC seems to work perfectly well without this extra line of code. Maybe I’m missing something? Can you give me a clue?
Whish list
1) Titles displayed from newest to oldest dates by default;
2) Scrolling feature
If the list of posts is very long, when you click on a category near the bottom of the list that doesn’t have many posts in it, the long ToC shrink or collapse to a tinny ToC that gets sometimes out of sight. When this shrinking event happens, you are left somewhere on the main page. The ToC user might get the feeling that something just went wrong. (test it on your own blog) .
I would like to know if it’s possible to add a kind of scrolling feature embedded in the Toc. The long list of posts and its related information would be displayed in a kind of ToC or table with a scrolling sidebar (like in the Leave your comment section on the Post a Comment page). The ToC or the table would display only a limited number of posts at the time but the scrolling feature would allow accessing all the posts easily.
Is this scrolling feature doable? If it's possible can you show me how?
No Rush!
Thank you for your widget, I hope you don't mind I blogged about the widget.
I did it! Thanks Hans as always.
Hello i'm from myanmar and
It doesn't work well at my blog. please explain me.
http://myoaung-mdy.blogspot.com
was my blog
regards
mdy
I have been looking for the TOC for hours and thank to your wonderful scrip and amateur like me can do it in less than 5 minutes. (http://uitmskm.blogspot.com)
Super duper!
Looks better when the link is above the post. More intuitive actually. Check it out guys.
Thanks for the hacks, Hans. You're my favourite Blogger Hacker beside Annie of BlogU. I did mentioned your name in a summary expandable post. I hope you don't mind.
A question: Hans, can you do a hack whereby in a browser will show our post's title first, then only our url. Eg. Name of post ~ blog url.
I hope you can understand what I'm tying to explain. Hope to hear from you soon.
Greetings and lotta loves from Malaysia.
am i the only one having trouble with this? All I can get is a drop down dialog box that says something like "wait a minute, the TOC is loading..."
I even started from a whole new blog to make sure the template was clean.
I think maybe I am not clear with the "skin" part of the instructions.
thanks for any help.
@barry: the messagebox means that the table of contents has not yet fully loaded. Make sure that you made no typing errors in the link to your blogs feed. Also, make sure that in your blog settings you have enabled the comment feed.
Also, now and then the leprachauns capture the Blogger servers, and every slows down to a standstill. In that case, wait a day and try again.
Thanks Hans! Got it working. I think it was the fact that I didn't realize the "skin" had to be a separate html element in the sidebar. Could never figure out where to put it in the template.
BTW, is there a simple way to just make the TOC "on" all the time?
I had a project that was stalled for a long time waiting for something like this, and now it can move forward, thanks again!
Hello Hans,
I have slightly modified this hack for use in my blog (hope you don't mind!). My TOC is featured in it's own post page instead of in widgets, which overcomes the problem of long blog loading times.
I have posted about this modification here: http://www.bloggerbuster.com/2007/10/how-to-create-table-of-contents-page.html
I would like to be able to make the TOC load immedietly as the page loads, rather than relying on the reader clicking on the link. I tried a few different methods, but nothing yet which works. Would this be possible to do? If so, please do let me know about this.
Best wishes, and thank you for all your great Blogger hacks,
Amanda
Hi,
I put your code to make a Table Of Contents Google Gadget. It seems to make it load faster. You can see it at the bottm of the posts column here :
http://tipsforbloggers.blogspot.com/
However I would like for bloggers to have a field to input their blog URL in it easily instead of in the code.
Hi hans, i've some problem with your beautifull method.
How can i delete this message of "showing all dthe 89 post" which appear when the table of content is showed.
secondly, my blog is in frenc, how can i translate post title, post date and lables.
wich you'll respond quick.
Again great thank.
Geweldig, Hans! Ik had de widget al eerder gezien, maar vandaag pas toegepast.
Dankjewel!:)
Thanks for sharing the TOC! You're a genius!
Is it possible to change "Show TOC / Hide TOC" says something else (replace it with some image button, for example) ??;)
Hi,
I am looking for a mouseover Table of contents showing 'titles' of the post.
I am tried to incorporate mouseover in flooble.com expandable.
Kindly give me pointers.
Regards,
Ashok Koparday
http://mysexdoctor.blogspot.com
For some strange reason my table of contents displays the contents of another website.
Here is my blog http://widgetsforfree.blogspot.com
My bad i fixed it
Thanks for genius widget, I've already implemented it in my blog. But every time I click the Show TOC link, my sidebar 'drops' below the so I have to scroll down to click the Hide TOC link. It's not like in your blog when you click, the TOC appears nicely on the main post and the sidebar doesn't drop dwon. Any idea how to fix it? Thanks alot!
@Finally Woken: read the instructions carefully again.You have put the div-element in your sidebar, it should be in the main-section of your blog. If you open the layout-editor, you should see a html/javascript page-element just above the blog posts page-element.
Hans, thanks alot. My mistake after all. Thanks again!
I've tried this, and while it worked very well, it doesn't really solve my problem, and it makes my page load much slower.
Initially, (and still) I wanted to REPLACE the dated blog archive list with a list of JUST titles. I think the triple-nesting is cumbersome and does not encourage readers to click. Isn't there a way to replace the standard blog archive list with a list of title, most recent on top? I did this in my previous blog (not hosted--my own) with just html. I know someone has to know how to do this, regardless of whether Blogger cares about it.
Thanks for any insight.
Jae Baeli
http://usedbythemuse.blogspot.com
Hullo Hans,
Thank you for the BlogToc widget.
A question:
In clicking the TOC link in the sidebar, is there code that will take me to the top of the table of contents?
I have installed the sidebar widget half way down the sidebar and it works perfectly.
However, I have to scroll up to the TOC to see it. A way of providing the link in the sidebar with an anchor to the top of the TOC would be greatly appreciated.
Again, my thanks.
Is there any way for links to be opened in a new window?
Thanks for the hack!
Muy útil widget. Gracias por el dato lo he implementado en mi blog. Saludos!
I am using it. But I did not change the html code. It really is not needed (as far I my set up). I left the "main" code as it was. I also did not add the css style, as it uses my site default css anyway. But I do love the code...thank you. You can see how it works without the html change here: plainweird.blogspot.com
Thanks very much for the great widget. I would just like to know if it would be possible to arrange the contents so that they are in chronological order? Thanks again.
@stephen: click on the POST DATE header of the table to sort the entries chronologically.
This is so awesome! It's exactly what I was looking for but didn't know I needed. Thank you!
Hans! Awesome widget! Thank you very much for sharing with us.
I've created a text widget in the sidebar below your Show/Hide TOC with usage tips, sorting, etc. I would rather display these tips at the top of the actual TOC. Thus, not visible unless Show TOC is clicked.
Q: Can I? and How would I?
Thanks in advance for any assistance!
Direct loading: Hi Hans! The BlogToC has a negative impact on the blog loading times. Many bloggers using your BlogToC get rid of it as the number of their messages increases. I’m getting near that point. I’m exploring for alternative solutions.
I’m trying your BlogToC on an alternative web page (see the «SOMMAIRE» section in the sidebar) in order to overcome the long blog loading times. I’m using an alternative web page to display the BlogToC like my Google Search Engine doses for the search results. I have also deleted the post summaries function.
I would also like to try the following modification:
- Get rid of the «Show ToC» and «Hide ToC» functions
I would like to be able to make the Blog ToC load immediately as the alternative web page loads, rather than relying on the readers clicking on a link on this alternative web page. I have tried a few different methods but I have been unsuccessful to achieve working results.
Can you help me to experiment with this specific goal and to achieve it? Thanks!
-----AutoLoad TOC------
hi there. thanks for this lovely hack/script. it works like charm. However, is it possible to autodisplay the toc, without having to click on the "show TOC" link. I've made the toc into a post, and i found that this solves the lagging loading time of my blog. But it's not very practical to have my visitors clicking after the page itself loaded. so, it'd be great if you can add the "onload" function.thanks
Nice hack, Hans!
Thank you very much!
I played around with it a little and found out how to load the TOC automaticly with the blog -
1. You need to write an extra funcion in the JavaScript which is almost like the original ShowToc:
function showToc2() {
if (tocLoaded) {
displayToc(postFilter);
}
else { alert("Bla Bla Bla"); }
}
2. You have to call this function in < body > tag of your blog:
< body onload='javascript:showToc2();'>
The function will be executed when the rest of the page is loaded.
3. You have to place the < div id='toc' /> line somewhere in the body of your blog (where you want the table to appear.
The result is quite nice. You can check my blog to see how it appears there:
http://ducoergosum.blogspot.com/
Hello,
I have a problem. When I load a page with some post (ex: http://webdoispontozeroplus.blogspot.com/2008/06/classificar-posts.html)
I can turn show to hide the toc; but when I load the simple blog url (http://webdoispontozeroplus.blogspot.com) when I click to show the posts the Toc shows, but the link doesn't turn to hide posts.
You can see it, please, in the sidebar, just below the flags to translate my blog. I say this because the show/hide link is in portuguese, so it is mostrar/esconder.
Can anyone help me to solve this problem?
Thank you very much.
Luis J.
Has anyone had any success with Bobby's adjustment to make the TOC appear automatically? If so, could he or she kindly point out exactly what piece of code goes where? Thanks very much.
i've been using this for a while but it suddenly stopped working, just show the "javascript:showToc();" in the status bar of the browser. Any ideas?
Hi Hans, looks like where you hosted the java for this is no longer operative. you know any way we can still make your hack work?
i really miss it..it so great !!
very much thanks hans...have a good day.
yes, PLEASE PLEASE fix the Javascrpt!!! We MISS your TOC Hans!!!
nothing to do hans...??
I just installed this on one of my blogs, and after some trouble, I got it working.
However, when I click the "hide" link, a character is left in the toc div, resulting in a gap I don't want there. I've looked all throughout the code and haven't been able to find out where it's coming from.
So, it there a way to add toggling of the toc div into the hidetoc and showtoc functions? I can kinda read JavaScript, but I can't write it.
Thanks for such a great widget!
Is it possible to add this hack like a standart widget to blogger ?
this is a real cool widget! thanks for creating and sharing this! got it working on mine with labelsort. =)
Thanks to you Hans, I`m Happy get this widget :)
How can i use this widget with feeds from feedburner? Thnks in advance
@Yugo: This TOC-widget uses a JSON-callback mechanism. That means: the code sends a request to the Blogger server, and the Blogger server send a javascript-formatted (JSON) feed back to your browser, where it is processed by the callback-function.
If you check the tutorial, you will see this line with "json-in-script" and "callback" stuff.
As far as I understand, Feedburner also supports JSON output (but I am not a Feedburner expert, so check it out yourself plz).
Secondly, it depends on the JSON-object tags that are used inside the feed. My widget looks for certain tagnames while processing the feed.
So, basically: yes, this widget can be used for processing any JSON-feed. The iffy part is: maybe you will have to change the sourcecode a little bit to make it work.
thank you for the reply. yeah..i've figured i'd have to change the code according to my xml feed.. but the only thing is i can't seen to get the json-in-scipt and the callback function to work on feedburner. anyway..it's a great widget, thanks for sharing it
how can i implement this widget in the older version of blogger?
Thanks for reading,.
@Zeithgeist: in the classical Blogger template things are basically the same.
Step 1: update template in case thinks go wrong;
Step 2: add <div id="toc"></div> where you want the TOC to appear.
Step 3: put this javascript-code in your template, for example in the sidebar.
Step 4: add CSS to the style-sheet of your template.
Make sure feeds are on.
It does not work on FTP-sites or private blogs.
thanks...
How do you set it to auto show so you don't need to click 'Show TOC'?
thanks, it's look interesting
thax
great hack! is there a way to only show the most recent posts (latest date) and just sort by label? thanks!
good post.,.,.:D
My blog, softbasket.blogspot.com doesn't work with this tutorial, the list doesn't show. But when I try the link from comment-poster here, http://www.bloggerbuster.com/2007/10/how-to-create-table-of-contents-page.html (it says slighly modified from yours), my blog successfully to display the TOC.
I can't give any comment yet, coz I don't know more about the code. Thanks for both of you!
Share your thoughts!
Feel free to post your questions, remarks and comments here. Moderation is set for this blog, so your comments will appear in due time.
Look who's linking here!
0 Backlinks point here