Pages

Table Of Contents Widget For Blogger @2theyouth

You might have noticed the new Table Of Contents Section On this Blog.. It uses the Selective Widget Display.. This widget requires Javascript ans hence it will take time to load.. So we will be modding it so that it will be displayed on a particular Page only..

Demo of TOC
Here is the Step by Step Tutorial
1.Make a new Blank Post in Blogger With Title "Table Of Contents" (or whatever you like)
2.Before publishing this post,make sure that you set the publishing date to an old one so that this post wont appear in your blog feed..You can Do it From Post Options in the Post Editor.. Also Don't allow comments on this post

3.Now we have created a new post page where the Table Of Contents will be displayed

4.Note down the URL of this post that we created
5.Find

in your template and replace it with the following code after applying the proper url




6.Now again edit your template.. Don't Expand the Widget Templates..
7.Find this line of code




and immediately after that place this code snippet..(after editing the snippet with your toc url)



Blog Table Of Contents



Loading The Blog TOC...





8.Now Find


and place this code immediately above it after tweaking it with your blog urls..(there are 2 urls..replace all those green urls properly)
<b:if cond='data:blog.url == "http://www.bloggerplugins.org/2005/06/table-of-contents.html"'>
<script style="text/javascript" src="http://blogger-plugins.googlecode.com/files/blogtoc.js"></script>
<script src="http://www.bloggerplugins.org/feeds/posts/default?alt=json-in-script&max-results=500&callback=loadtoc"></script>
<script src="http://www.bloggerplugins.org/feeds/posts/default?alt=json-in-script&start-index=501&max-results=500&callback=loadtoc"></script>
<script src="http://www.bloggerplugins.org/feeds/posts/default?alt=json-in-script&start-index=1001&max-results=500&callback=loadtoc"></script>
<script type="text/javascript">showToc();</script>
b:if>


Now try visiting your TOC Page.. Got it working?? If you failed.. don't worry.. i can help you out..Contact me @ Blogger Forum or via comments
Credits:Special Thanks to Hans of Beautiful Beta for the javascript that powers the TOC
If you got it working show us the url.. We will help you in any further tweaking and let you know if any changes are needed...


0 comments:

Post a Comment