If You Want top backlinks or free guest posting on our blog Lets do it Adsense Ready theme Now!

Creating a Table of Contents in Blogger Posts

visiting the Wikipedia site, you will definitely be presented with a list of article contents, where when clicked it will automatically go directly to


Table of contents

  • MIUSM-TECH.COM - When visiting the Wikipedia site, you will definitely be presented with a list of article contents, where when clicked it will automatically go directly to the intended menu, the feature is called table of contents.

Table of Content or it can also be called a table of contents is very important in a blog post because it will make it easier for visitors to go directly to the menu they are looking for, especially in a very long article.

Besides functioning as a jump link in blog posts, Table of contents is also very useful for SEO. Because the menu will be indexed and appear on the Google search page.

If you want to apply this Table of Contents on your blog, it's quite easy, just using some CSS and HTML code.
Below is an example of the Table of Content that we will create:

Without further ado, let's look at how to create a Table of Contents for posts on blogger.

1. CSS code installation

First, you need to add this Table of Contents CSS code to beautify the appearance, Copy the code below above the closing tag </style> or ]]></b:skin>
/* Table of Contents */
.toc {background-color:#f8f9fa; border:1px solid #a2a9b1; padding:10px 13px; display:table; line-height:1.6em;}
.toc h3 {display:inline-block; margin-right:10px}
.toc a {text-decoration:none}
.toc a:hover {text-decoration:underline}
.toc ul {list-style-type:none; list-style-image:none; margin:0px; padding:0px; text-align:left}
.toc ul li {list-style-type:none;}
.toc ul li a {margin-left:.5em}
.toc ul li ul {margin-left:2em}
.toctogglelabel {cursor:pointer; color:#0645ad}
:not(:checked) > .toctoggle {display:inline !important; position:absolute;  opacity:0}
:not(:checked) > .toctogglespan:before {content:'['}
.toctoggle:not(:checked) + .toctitle .toctogglelabel:after {content:'sembunyikan';display: inline}
.toctoggle:checked + .toctitle .toctogglelabel:after {content:'tampilkan'}
:not(:checked) > .toctogglespan:after {content:']'}
.toctoggle:checked ~ ul{display:none}
:target::before {content:''; display:block; height:0px; margin-top:0px;  visibility:hidden}

Notice the last line of code :target::before . If you use the sticky header/navigation menu, change the height and margin-top according to the size of the installed header/navigation. For example, the size is 50px, then change it to height:50px and margin-top:-50px .

2. Writing HTML code in Posts

Now we just apply to posts on blogger. Make sure you select HTML mode instead of Compose when creating a new post. Then save the code below at the beginning or where the Table of Contents is displayed.
<div class="toc">
  <input type="checkbox" role="button" id="toctoggle" class="toctoggle"><div class="toctitle"><h3>Daftar isi</h3><span class="toctogglespan"><label class="toctogglelabel" for="toctoggle"></label></span></div>
  <ul>
    <li>1 <a href="#toc1" title="Judul Satu">Judul Satu</a></li>
    <li>2 <a href="#toc2" title="Judul Dua">Judul Dua</a></li>
    <li>3 <a href="#toc3" title="Judul Tiga">Judul Tiga</a></li>
    <li>4 <a href="#toc4" title="Judul Empat">Judul Empat</a></li>
    <li>5 <a href="#toc5" title="Judul Lima">Judul Lima</a></li>
  </ul>
</div>

#toc1#toc2and so on is the calling tag. You can add or subtract as needed.

Then set the writing in the heading or title in the post by including the same id as the table of contents. Examples like this.

<h3 id="toc1">Judul Satu</h3>
...isi paragraf satu
<h3 id="toc2">Judul Dua</h3>
...isi paragraf dua
<h3 id="toc3">Judul Tiga</h3>
...isi paragraf tiga
<h3 id="toc4">Judul Empat</h3>
...isi paragraf empat
<h3 id="toc5">Judul Lima</h3>
...isi paragraf lima

3. Hide Table of Contents Menu

If you want the table of contents or table of contents to be hidden when loading, just add text checked on tags input as follows:
<input type="checkbox" role="button" id="toctoggle" class="toctoggle" checked><div class="toctitle"><h3>Daftar isi</h3><span class="toctogglespan"><label class="toctogglelabel" for="toctoggle"></label></span></div>

4. The "Hide/Show" Button Doesn't Appear

This problem occurs frequently to most of the users. To fix this, make sure NOT to put a line break <br/>(enter) in the TOC header section.
The correct example is like this:
<input type="checkbox" role="button" id="toctoggle" class="toctoggle"><div class="toctitle"><h3>Daftar isi</h3><span class="toctogglespan"><label class="toctogglelabel" for="toctoggle"></label></span></div>
And this is a WRONG example:
<input type="checkbox" role="button" id="toctoggle" class="toctoggle">
<div class="toctitle">
  <h3>Daftar isi</h3>
  <span class="toctogglespan"><label class="toctogglelabel" for="toctoggle"></label></span>
</div>


Maybe that's the post this time about Creating a Table of Contents in Blogger Posts , hopefully it's easy to understand and also useful.
See you....

1 comment

  1. Bhai os post pe itna view samch me aya hai. 😂
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.