Do you want to know how to create a table of contents in WordPress?
Creating a table of contents (ToC) in WordPress can be tricky if you’re a beginner. Even if you’re an expert, using WordPress’ default method can rob you of a few precious minutes you could spend doing other productive things.
In this article, we’ll show you how to automatically create a table of contents in WordPress and easily customize it to save you time.
Why is a Table of Contents Important in WordPress?
A table of contents helps users easily navigate your post, enhancing the user experience (UX). Most readers simply want to jump to the section with the answer they’re looking for, and a Table of Content helps them do that.
Another benefit of a table of contents is that it helps you drive up your clickthrough rates (CTR) in SEO. Articles with a table of contents are more engaging and interactive on search engine results pages (SERPs) because they are enhanced by jump links.
Jump links are an excellent way to encourage visitors to click on your website and go straight to the section they’re most interested in. The high CTR signals to search engines that users find your content valuable, and as a result, your SEO rankings improve.
Another advantage of tables of contents is that they can help you land the coveted featured snippet to get you maximum SEO traffic.
Search engines often pull listicle-based snippets of content to display as the featured snippet. The main reason is that lists (like tables of contents) and bullet points can clearly and concisely communicate answers to users’ questions.
How to Create a Table of Contents in WordPress
The biggest challenge with creating a table of contents in WordPress is that it can take a lot of time to manually add jump links.
Luckily, there is a way that allows you to automatically add a table of contents in WordPress and even customize the headings.
In this tutorial, we will cover both methods on how to automatically create a table of contents in WordPress using a plugin as well as how to manually create a table of contents using code.
With that said, let’s jump right in.
Method 1: How to Automatically Create a Table of Contents in WordPress
The easiest way to automatically create a table of contents in WordPress is by using the Table of Contents feature in All in One SEO plugin.
AIOSEO is one of the best WordPress SEO plugins in the market, used by over 3 million website owners. Aside from dozens of powerful SEO features, it also comes with an advanced Table of Contents block that lets you automatically create a table of contents in WordPress.
Once you have installed and set up the plugin, you’re now ready to add a table of contents in WordPress.
Step 1: Add the AIOSEO -Table of Contents Block
To add a table of contents to your blog post, all you have to do is open the WordPress content editor and then click the Add block button.
Next, you need to select the AIOSEO – Table of Contents block:
Once you click on the AIOSEO – Table of Contents block, it will automatically create a table of contents block with all your subheadings.
Step 2: How to Customize Your Table of Contents
Not only does the Table of Contents block saves you time by automatically generating a table of contents, but it also has powerful customization features. For example, you can:
- Customize the heading text in the table of contents
- Choose to hide and re-order headings inside the Table of Contents block
- Customize the table of contents anchors
To customize your table of contents, you need to click on the block’s options menu.
From here, you can choose to reorder items in the table of contents or hide certain items.
You’ll find other Table of Contents block customization options in the editor’s sidebar:
Here, you can change the list style and other advanced design settings.
Once you’re done customizing your table of contents, make sure to save your draft, and that’s it!
Congrats, you’ve successfully added a table of contents in WordPress.
Method 2: How to Manually Create a Table of Contents in WordPress
If you don’t want to use a table of contents plugin in WordPress, then you can also manually create a table of contents in WordPress. However, the process can be very time-consuming.
Let’s take a look at the manual steps.
Step 1: Create HTML Anchors
The first step is to add HTML anchors to your header tags or subheadings. These HTML anchors will serve as internal links that you’ll use to link your various content subheadings in your table of contents.
To get started, click on any subheading in the content editor.
Next, go to the Block settings in the sidebar and scroll down to the Advanced section. Then, type in your tag in the HTML anchor field.
Your HTML anchor should be similar to your subheading. This will help you remember the HTML anchor associated with each subheading.
Step 2: Create a Table of Contents Using a Regular Content Block
Once you’ve created your HTML anchors, you can now create your table of contents.
First, add a Paragraph block where you want to display your table of contents and title it accordingly.
Next, add a List block where you’ll list all your subheadings. You can either type them out or copy and paste them.
This will serve as your table of contents.
Step 3: Link Your Sub-headings inside the Table of Contents
Once you’re done creating your table of contents listing, the next step is to link it to your subheadings using the HTML anchors you created.
To do that, highlight a list item in the table of contents and click on the Link icon.
Next, type in the HTML anchor corresponding to the subheading you’re linking to and make sure to precede it with a hashtag (#). Once done, click on the Enter icon (or hit Enter on your keyboard), and the HTML anchor will be added to your table of contents list.
Repeat the process for the rest of the items on your table of contents.
As you’ll notice through the process, if your table of contents is long, then this can be quite time-consuming. That’s why we always recommend using our Table of Contents block.
We hope this article has helped you know how to add a table of contents in WordPress easily. Once you’re done, you may also want to check out some of our tutorials. A great example is our guide on how to add an FAQ section in WordPress. You may also want to check out our ultimate link building guide.
If you found this article helpful, then please subscribe to our YouTube Channel. You’ll find many more helpful tutorials there. You can also follow us on Twitter, LinkedIn, or Facebook to stay in the loop.