How to create a table of contents for Google Blogger posts based on their labels

Example of the generated table of contents
Example of the generated table of contents

A javascript that creates a table of contents of posts based on the Blogger label name.


I found it frustrating whenever I was looking for my older posts using the label page if the posts count of the specific label is more than 20 posts. This is because I will need to click on the more posts or older posts button at the end of the label page to get me to the next 20 older posts. What if I can just list the posts in a single page like a table of contents displaying just the post titles. I don't need the snippets and thumbnails as the important thing for me is to get the information fast.

My solution to this is a javascript that creates a table of contents based on the Blogger label RSS url. My blog currently has quite a number of labels so I would limit that I would only create a table of contents for a label that has more than 20 posts count. The final thing to do after setting up the table of content page is to setup the redirect from your Blogger "settings > Search preferences" to redirect the label url to the table of contents page.

This is how to do it in steps:

Step 1 : Download and save this TOC javascript file and host it on your own server.

Step 2 : Create a new post and switch to HTML editing mode.

Step 4 : Copy and paste the block of code below into the editor.

<script src="path-to-javascript-file/blogtoc-min.js">
</script>
<script src="your-blog-url/feeds/posts/default/-/your-label-name?max-results=9999&amp;alt=json-in-script&amp;callback=loadtoc">
</script>

Step 5 : Replace the path-to-javascript-file with your hosted file url.

Step 6 : Replace the your-blog-url with your blog url.

Step 7 : Replace the your-label-name with your label name. You can get this from your label page url. For example : your-blog-url/search/label/your-label-name

Step 8 : Save the new post and publish it.


Comments

Popular posts from this blog