How to add a Table of Content in Blogger

In this blog post, I am going to show how you can add a Table of Content in your blogger blog post. As you know, Blogger does not support Plugins like WordPress does, However, if you have little tech knowledge you can easily create a custom-designed lightweight toc for your blog.

So I this post I will show step by step method to make TOC for your blog post and pages.

But before we get started, Let’s discuss some benefits for having a TOC in your blog post.

Also check out: Submit blogger sitemap to Google Search Console

SEO Benefits of TOC

As you know Google loves the very detailed and well-structured blog posts and web pages. And by adding toc in your blog post you can make your blog post more structured.
And If your blog post will be well structured then google can display Jump to links in the meta description in Search Result Page.
Which is a huge Blogspot SEO benefit!
Now, Here is an example of Google Jump to links.

Google jump to links

Improved User Experience

User experience is another very important part of a blog which lots of Blogger don’t take seriously. But here is the game,
according to a study user experience is the key to get higher ranking in SERP.
And a Table of Content will going to help you, improve the user experience of your website.
According to a research by NN Group, more than 79% of total web readers are scanners who only read the important points of a webpage.

NN group research on web readers

And adding a TOC will allow your readers to jump to the important part of a blog post. Which can be a breakthrough for user experience of your website.

Now, lets first discuss how you can automatically add a table of contents in google blogger posts.

Before you dive deeper in this blog post, I want to invite you to join our community (Group) on Facebook, a group of friendly entrepreneurs who are ready to help each other Click here to join us.

Here is How to Automatically Create Table of Contents in Blogger

I am going to divide the workflow of making a TOC into 5 easy steps so it will become super easy for you to implement.

Step 1: Now, the first thing you need to do is Login to your Blogger dashboard and then go to the Theme editor. 
And click on the Edit Html button. 
Blogger Dashboard >> Theme >> Edit Html 



It will bring you lots of codes on your screen.
Here, you have to paste the codes given below
Just above the close heading tag </head>

how to create table of content in blogger

<link href='http://fortawesome.github.io/Font-Awesome/assets/font-awesome/css/font-awesome.css' rel='stylesheet'/>           
<link href='http://fonts.googleapis.com/css?family=Oswald' rel='stylesheet' type='text/css'/>
<script type='text/javascript'>              
//<![CDATA[           
//*************TOC plugin by MyBloggerTricks.com           
function mbtTOC() {var mbtTOC=i=headlength=gethead=0;           
headlength = document.getElementById("post-toc").getElementsByTagName("h2").length;for (i = 0; i < headlength; i++)           
{gethead = document.getElementById("post-toc").getElementsByTagName("h2")[i].textContent;document.getElementById("post-toc").getElementsByTagName("h2")[i].setAttribute("id", "point"+i);mbtTOC = "<li><a href='#point"+i+"'>"+gethead+"</a></li>";document.getElementById("mbtTOC").innerHTML += mbtTOC;}}function mbtToggle() {var mbt = document.getElementById('mbtTOC');if (mbt .style.display === 'none') {mbt .style.display = 'block';} else {mbt .style.display = 'none';}}           
//]]>              
</script>

Step 2: In this step, we are going to style our table of content. 
To do that you need to paste these CSS codes 
Find the ]]</b:skin> in your screen and paste the CSS codes just above the ]]</b:skin>

style css for table of content for blogger

.mbtTOC{
        border:5px solid #f7f0b8;
        box-shadow:1px 1px 0 #EDE396;
        background-color:#FFFFE0;
        color:#707037;
        line-height:1.4em;
        margin:30px auto;
        padding:20px 30px 20px 10px;
        font-family:oswald, arial;
        display: block;
         width: 70%;
        } 
		
.mbtTOC ol,.mbtTOC ul {
        margin:0;
        padding:0;
                      } 
					  
.mbtTOC ul {
        list-style:none;
           }   
		   
.mbtTOC ol li,.mbtTOC ul li {
        padding:15px 0 0;
        margin:0 0 0 30px;
        font-size:15px;
                            } 
          
.mbtTOC a{
        color:#0080ff;
        text-decoration:none;
          } 
          
.mbtTOC a:hover{
        text-decoration:underline; 
              }

        
.mbtTOC button{
        background:#FFFFE0;
        font-family:oswald, arial; 
        font-size:20px;position:relative; 
        outline:none;
        cursor:pointer; 
        border:none; 
        color:#707037;
        padding:0 0 0 15px;
               }  
			   
.mbtTOC button:after{
        content: "\f0dc"; 
        font-family:FontAwesome; 
        position:relative; 
        left:10px; 
        font-size:20px;
                    }

Step 3: Here you just have to tweak a line or two of code in blogger theme. Search for the code <data:post.body/>  and replace it with the code given below. 
If you find more than one <data:post.body/> then replace all with the codes given below.

changing codes in blogger theme
<div id="post-toc"><data:post.body/></div>

Step 4: Now, In this step, we are going to activate the TOC in our blog posts. 
It is quite simple and easy to do. 
First thing you need to do is paste the Html code given below in the blog post, where you want to show the table of content.  
I will recommend you to paste the code after the first paragraph of your blog post. 

toc html codes in blog post

<div class="mbtTOC"> 
    <button onclick="mbtToggle()">Contents</button> 
    <ol id="mbtTOC"></ol> 
</div>

Step 5: And this is the last step here, you need to paste this JS code at the very bottom of the blog post or page where you want to display the table of content. 

activating table of content

<script>mbtTOC();</script>

That’s it you are done!
You have successfully created an automated toc for your blog post.

Note:- This project has developed by mybloggingtricks.com so big shout out for them.
But keep in mind that this table of content has only made with XML and Javascript codes, so it can make your blog too heavy to load. 
And it is also not stylish to look… 

But don’t worry, I will help you to create easy to load and stylish TOC with only HTML and CSS.

How to add a Table of Content in Blogger with HTML and CSS

It can be an easy task to create Toc in Html and CSS for a web developer but it can not be an easy task for a non-techy person.
But here, I will you show you step by step method which will be comfortable for both techy and non-techy person.
Here is the deal

table-of-content-design-for bloggerIn this method, we will be going to establish this design.

Step 1:- In this step, you have to copy all the CSS codes given below and paste it into the root of your blogger theme. 

/* Starting of TOC Css Codes */
.mb-toc {
    border: 2px solid #ddd;
    background: #ececec;
    padding: 5px 20px 20px;
    margin: 40px 0;
    font-size: 18px;
    overflow: hidden;
    border-radius: 5px;
}

.mb-toc h2 {
    margin: 10px 20px;
    font-size: 30px;
}

.mb-toc ul {
    margin: 0;
    list-style: none;
    float: left;
    width: 100%;
}

.mb-toc ul ul li a {
    padding-left: 45px;
}

.mb-toc ul ul li {
    background: none;
}

.mb-toc li {
    list-style-type: none;
    position: relative;
    margin: 0;
    cursor: pointer;
    background: #f7f7f7;
    float: left;
    width: 100%;
}

.mb-toc li:nth-child(odd) {
    background: #fff !important;
    overflow: hidden;
    clear: both;
}

.mb-toc li:nth-child(odd) li:nth-child(odd) {
    background: none;
}

.mb-toc li:nth-child(even) {
    background: #f7f7f7 !important;
    overflow: hidden;
    clear: both;
}

.mb-toc li:nth-child(even) li:nth-child(odd) {
    background: none;
}

.mb-toc ul>li:hover>a {
    background: #fffcd1;
}

.mb-toc li a {
    color: inherit;
    padding: 8px 0 8px 25px;
    float: left;
    border-bottom: 1px solid #ddd;
    width: 100%;
	text-decoration: none;
}
/* Ending of TOC css Code */ 

Step 2:- To paste the CSS codes, open the dashboard of your blogger blog then go to Layout and then Theme Designer…
Dashboard >> Layout >> Theme Designer 

blogger layout
And then in theme designer click to Advanced and go to Add CSS
Advanced >> Add CSS 

adding css in blogger
Now paste all the CSS codes here

Step 3:- In this step, you have to paste the HTML codes given below to your blog pages and posts. You need to paste this code in your blog post and page every time you want to display Table of Content. 

<div id="toc" class="mb-toc">
 <h2>Table Of Contents</h2>
 <ul>
        <li><a href="#headingid1">1. Your heading text </a></li>
        <li><a href="#headingid2">2. Your heading text</a></li>
        <li><a href="#headingid3">3. Your heading text</a></li>
	<li><a href="#headingid4">4. Your heading text</a></li>
        <li><a href="#headingid5">5. Your heading text</a></li>
</ul>
</div>

Step 4:- Now you have to add a unique Id to your heading tags in your blog post.

adding id in heading tag

Step 5:-  After adding the unique id to your heading tags replace the Id in Html codes and change the anchor text.

adding id and text in html code

Boom!
You have successfully created a stylish looking and easy to load table of contents for your blog.

Conclusion:- Ahha You are done, You have created a good looking and SEO friendly table of contents for your blogger blog post and pages. 
This custom-designed TOC will help you to attract the user’s attention. 
However, do let me know if you are having any problem? 

niche research guide

Now! Which method you are going to use? Are you going to use a custom-designed method or automated method?
Please let me know in the comments section…

add table of content in blogger post and pages

72 thoughts on “How to add a Table of Content in Blogger”

  1. actually, I used it but it just shows up only [ content ] and no any formation of table of content what should I do now kindly check I m ur regular viewer and your all posts help me very much.

  2. Hi Bitu,

    That’s a super well-guided article. Table of content has lots of benefits, it looks clear and organized. I’ve always wanted to use it on my blog but didn’t get well enough article for this.

    I will surely come back to you if I have any issues. I’m truly grateful to encountered this needed article.

    Thanks,
    🙂

    • Hey Sahil
      I think you are doing any mistake in step 4 and 5.
      You have to add an id in your heading tag.
      And then you need to add that id in href section of table of contents.

      If you still having problem then you can ask it in our Facebook group.

      Wish you all the very best

    • Hey probin,
      There will be this code ]] .
      Otherwise you can paste it into css field of your blog.
      To add it in css section follow these steps.
      From your blogger dashboard go to Layout >> Theme Designer
      Then Advanced >> Add CSS

      Now paste that css codes there.

      If you still find any problems do let me know. Or you can ask me at our Facebook group.
      Join it from the link at the bottom.

      • Oh sorry I didn’t paste right. My table of contents works but after a few days I click on one of the links and it goes to blogger homepage. I can see this code where the table of contents beginning is
        href=”https://www.blogger.com/u/1/blogger.g?blogID=2542684277789945518#one”>1. Journal </li

        I did the css code. Like I said everything works when I publish then after a few days it doesn't. I am not sure what is happening

  3. Hi.
    The TOC is only taking the main headings. do you have an idea how it could also include the subheadings?

  4. Hi sir, this table is wonderful but the problem is the table is not in the perfect width and height according to my website. Please help me…

  5. this is really usefeul! thank you..However, how do I link the content to the table of content. I am doing something not right 🙁 Also, it also shows a bit bigger than I thought in my website. I would appreciate your help!

  6. Thank you so much for this article bro but I have one question, will this TOC appear in Google search results? I mean does it affect SEO or help us rank better?

  7. Thanks, this really helped! The automatic table script didn’t work, but with the CSS, it worked!

  8. First one is better. But i habe a question. Like in wordpress initially table of content is hide and when user click on “hide” then list will be shown. But in blogger table of content is shown direvtly.

    How can i achieve this as it is in wordpress?

    Please reply

  9. using HTML and CSS code to add Table of content but when click to any point in table of content not go direct into that heading.

  10. Hai I have found what went wrong, now its working but the only problem is before the numbers it shows some symbol like > can you please tell me how to remove it. Thank You

  11. Thank you for sharing such a wonderful code. I really enjoyed this code. It is really helping me lots to write the post to show to my readers, how good it is when we showcase table of contents.

Comments are closed.

24 Shares
24 Shares
Copy link