Home / Articles / WordPress / How to Create a Table of Content for Your WordPress Site

How to Create a Table of Content for Your WordPress Site

Did you know that Google, a search engine giant with over 93% of the market share, considers topical depth a critical indicator to determine your rankings?

Unlike many other search engine platforms, Google prefers a detailed page over a dozen with thin content. So, if you’ve been publishing long-form content for your audience lately, you are on the right track.

However, the problem with publishing longer posts is that they may end up affecting your engagement.

We live in a world where everyone is always in a rush. People want access to relevant information in an instant. So, they’d be less likely to navigate through a 2000+ words article to find the answers they seek.

Nevertheless, you don’t have to choose one or the other, as there’s a way you can keep up with the current SEO best practices without having to lose engagement in the process.

And that is adding a table of contents to your posts. A table of contents makes it easier for your visitors to navigate content with ease and access required information without having to go through the entire article.

However, adding a table of contents (ToC) to your posts can be a bit tricky, especially if you’ve just gotten started.

So, we’ve created this post to help out beginners and show them how they can add a table of contents to their WordPress site.

Benefits of Adding a ToC

Before moving ahead with the guide, let’s first talk about why it’s important for you to add a table of contents to your WordPress site.

Adding a table of contents to your site may seem like overkill to you, but it’s not. As a matter of fact, it can go a long way and help improve your user experience.

Most people don’t have the time to read an entire post. They just want to access information that is relevant to them and helps them make informed choices.

A table of contents makes it easier for them to explore different sections of an article rather than scrolling through the entire thing to find the required information.

With just a single click, they can jump from one part of an article to another and easily find what they need.

Since adding a table of contents is a way to offer a better user experience, it automatically complements your site’s SEO and helps you climb the SERPs.

Plus, adding a ToC to your content increases the chances for your posts to be listed as a featured snippet and appear at the top of the research results, which in turn helps you generate more organic traffic.

A ToC also serves as an excellent way to add relevant keywords to your content and improve the keyword density, which in turn plays a vital role in improving search engine rankings.

Overall, adding a table of contents to your posts not only enables you to offer a seamless experience to your visitors that breeds high engagement but can also prove to be an excellent tactic that fuels your SEO.

How to Add a Table of Contents to Your WP Site?

There are two simple ways to add a table of contents to your WordPress site. We’ll explain both processes in detail and let you decide which one works best for you.

Let’s get started with the manual process first.

Adding a ToC Manually

To manually add a table of contents to your post, the first thing you need to do is add a ‘list block’ in your article.

Once you’ve done that, the next thing you need to do is add the headings that comprise your article, one by one.

The next step is adding an ‘anchor attribute’ to your article headings that you wish to use as a reference for your table of contents.

This will help your visitors jump to a particular section that interests them by simply clicking on the heading prescribed in a table of contents.

To add an anchor attribute, select the first heading in your article, then click the ‘advanced tab’ in the block settings appearing at the right side of the window.

Clicking on the advanced tab would lead you to ‘advanced settings’ where you’d have to enter a unique phrase or a word to be the ‘HTML anchor’ for the heading selected.

If you’re adding a phrase to represent your heading and not a single word, make sure that you’ve not used any spaces and separated the words using the hyphen ‘-’.

You’ve successfully added an anchor attribute for your first heading. Now, repeat the process for the rest of the headings in your article.

Once you’ve set the anchor attributes for all the headings in your article, the next step is linking the HTML anchors of your headings to the fields of a table of contents you've created.

To get started, select the first field in the ‘list block’ of a table of contents, then click on the ‘link icon’ from the toolbar. You can also use the shortcut key ‘Ctrl+K’ to perform the same function.

Next, you’d have to add the anchor for the respective heading in a table of contents. To do that, type a hashtag ‘#’ in the field as shown in the picture below, followed by the anchor text for that particular heading.

The hashtag works as a functional parameter for WordPress and triggers the command that allows a user to jump to a specific section in the post by simply clicking the respective field in the table of contents.

To avoid typographical errors, it’s best that you simply copy the anchor text from ‘advanced settings’ in the ‘block menu’ and paste it into the field.

Once you’ve added the anchor text, simply click the ‘enter icon’ to add the link to the respective field.

Make sure that the ‘open in a new tab’ option is disabled if you don’t want the required information to be displayed in a new tab for the users.

An anchor to the selected field in the table of contents has been successfully added. Now, simply repeat the process for all the fields in a ToC.

Congratulations! You’ve successfully added a table of contents to your article. Now, when visitors click on a particular field in a table of contents, they'll automatically jump to that particular section and access the required information with ease.

However, adding a table of contents to each of your posts manually can be tedious and time-consuming, especially when the posts contain multiple headings.

Fortunately, there’s an alternate process that you can consider if this one seems like a bit of a hassle to you.

Adding ToC Using a Plugin

There are a variety of WordPress plugins that you can use to add a table of contents to your posts in just a few seconds.

To get started with this process, choose any WordPress table of contents plugin and install it. To install the plugin, go to ‘WordPress dashboard’, scroll down to ‘plugins’, and click ‘add new’.

We’ll be using AIOSEO to proceed with the steps here, but you can choose any plugin that best serves your needs.

Once you’ve successfully installed the plugin, edit the post you want to add a table of contents to. Look for ‘toggle block inserter’ in the top left corner and click it to view block options.

Scroll down to the ‘design section’ and locate the ‘AIOSEO table of contents block’. Now, just drag the block and drop it in the body of your post.

The plugin will automatically create a table of contents for you, which you can adjust and customize to your liking.

This is one of the easiest ways to add a table of contents to your WordPress site. The plugin will automatically detect your headings, add them to the table of contents, and adjust the indentation in the table with respect to the heading levels.

You can continue working on your article even after adding a ToC, as the plugin will automatically detect new headings when created and update a table of contents in real-time.

So, you don’t have to worry about making amends to your ToC or re-creating it from scratch each time you edit your post.

You can also choose a different list style for a table of contents by clicking the ‘settings icon’ in the top right corner.

And when you’re happy with how your table of contents looks, simply click ‘done’ to save the changes.

The use of plugins makes it easier for you to add a table of contents to your WordPress site. It’s a less cumbersome method compared to the manual process and encompasses a minimal likelihood of human error. But you can choose whichever method seems more appealing to you.

Final Words

We highly recommend that you add a table of contents to your posts. It helps you offer a seamless user experience and makes it easier for your visitors to find relevant information without having to skim through an entire page.

Plus, adding a table of contents to your post increases the chances for your article to be listed as a featured snippet, which in turn helps you generate higher traction.

Photo of author

Article by Syed Balkhi

Keep Reading