Skip to main content
All Collections
Wordpress article : How to create a table of contents
Wordpress article : How to create a table of contents
C
Written by Celina
Updated over a year ago

Objective

We want to creat a table of contents for the blog posts similar to this:: https://blog.smartkeyword.io/balise-h1-seo/

We want to do this for three reasons:

  • For long articles, readers can go directly to the information they’re interested in

  • For SEO content:

    • To increase the CTR from the result pages

    • To appear in an answer box / position 0 or in the people also ask results

Method

<strong>Summary:</strong>

<ul>

<li><a href="#CODE">Title</a></li>

<li><a href="#CODE">Title</a></li>

<li><a href="#CODE">Title</a></li>

<li><a href="#CODE">Title</a></li>

</ul>

→ Replace in the code all h2's with

<h2 id="CODE">Title</h2>

→ the table of contents anchors (part after the #) must be in lowercase and spaces are to be replaced by underscores "_" and must briefly describe the title.

→ the id of the h2 must be the same as the anchor of the summary

<a href="#definition_tag_h1">Definition of H1 tag</a></li>

<h2 id="definition_balise_h1" class="intercom-align-left">Definition of H1 tag</h2>

Did this answer your question?