How to Create a Table of Contents in WordPress Posts and Pages
Would you like your WordPress posts or pages to have a table of contents?
A table of contents can simplify reading a lengthy post and boost the SEO of your website. But making them can be challenging for beginners.
We’ll demonstrate how to make a table of contents in WordPress posts and pages in this article.
Why Include a Table of Contents in WordPress Posts and Pages?
On websites like Wikipedia, the table of contents might be familiar to you. For our lengthy guides, like our comprehensive guide to WordPress speed and performance, we also use them on WPBeginner.
On your WordPress website, you can add a table of contents to posts to make it simpler to navigate between the many sections of a lengthy article.
They not only enhance user experience but also benefit your WordPress SEO. This is so that Google may utilize the table of contents to offer “jump to section” links to search results automatically.
The featured snippet at the top of the search engine results page is another benefit of having a table of contents for your post. You will benefit most from this in terms of SEO traffic.
So, let’s look at how to make a table of contents for WordPress posts and pages. We’ll demonstrate both automated methods using a plugin and manual methods utilizing anchor links:
- Automatically Adding a Table of Contents in WordPress (recommended)
- Manually Adding a Table of Contents in WordPress
Automatically Adding a Table of Contents in WordPress
We advise using this approach since it saves you time by creating the table of contents automatically based on your subheadings and also makes it fully editable with editable links.
The free version is all you need to quickly construct a table of contents, but AIOSEO Pro adds additional capabilities to raise your search engine ranking.
After activation, the plugin must be configured using the AIOSEO setup wizard. Visit our setup guide for All in One SEO for WordPress for further instructions.
Using AIOSEO to add a Table of Contents
The post or page where you want to add the table of contents must first be created or edited. After that, locate the “AIOSEO – Table of Contents” block by clicking the blue “+” icon.
To make the table of contents display on a post or page, simply drag the block there.
The ‘AIOSEO – Table of Contents’ block may become grayed out after you add a table of contents. This is due to the fact that each post or page can only contain one table of contents.
Your table of contents will automatically be updated with the headers that the plugin has detected on the page. Lower level headers will be indented to indicate the organization of your material if you utilize different heading levels (for example, H2 and H3).
Any headings you create while still writing your post’s or page’s content will be instantly put to the table of contents.
AIOSEO’s ability to customize the Table of Contents
The table of contents can be altered in a few different ways to suit your needs. For instance, you can rename a heading by clicking on it. The article will not be changed; only the heading in the table of contents.
For each heading, AIOSEO will automatically construct an anchor link. The anchor text can be altered in the table of contents and at the heading in the post content by clicking on the Link icon.
To hide a heading, click the eye icon next to any of the headers. The table of contents block’s heads can be rearranged by AIOSEO Pro users. By doing this, the table of contents’ heads will be rearranged but not the article’s.
A block setting can be found on the sidebar as well. For your table of contents, you may select either a bulleted or numbered list format below.
You must click the “Done” button to save your changes when you have completed creating your table of contents.
You may now visualize how your visitors will perceive the table of contents.
A title or paragraph should be placed above the table of contents. Your viewers will understand that they are looking at a table of contents if you do this.
Your site visitors will be led directly to a heading in the article when they click a link in the table of contents. Users are now able to quickly go to the section they’re most interested in.
The ability to edit headings and selectively hide headings as necessary makes AIOSEO’s table of content feature superior to another WordPress table of content plugins.
The majority of other tables of content plugins simply lack this essential capability.
Manually Adding a Table of Contents in WordPress
You don’t need a plugin to manually add a table of contents by using anchor links. This will need more time and energy, though.
In our tutorial on adding anchor links to WordPress, we go into further detail about anchor links.
Table of Contents input
In order to add the headings for the table of contents, you must first add a “List” block. The headlines can either be typed into the list or individually copied and pasted from your article content.
How to Make Heading Blocks Have Anchor Text
The next step is to give each heading you want to reference in the table of contents an anchor property. When a visitor clicks a heading in the table of contents, this will tell WordPress where to leap to.
To begin, click on the header, which can be H2 or H3. The advanced options will then appear if you select the “Advanced” button in the block settings window.
Then, without using spaces, type a distinct word or phrase into the “HTML anchor” field. Hyphens can be used to divide each word if desired.
Simply repeat this procedure for each additional heading that will be present in the table of contents.
Hint: Hyphens will be added automatically if you paste the heading into this area. This is a simple method for producing a distinctive ID that also amply illustrates the topic.
Enhancing the Table of Contents using Anchor Links
The table of contents’ heads should be linked to the HTML anchors you made as the final step.
The first item in your List block should be highlighted, and then you should click the ‘Link’ option in the toolbar.
The anchor text for that heading should then be typed or pasted after the hashtag (#).
WordPress is instructed to jump to that area of the current post by the #. The domain name and other URL parameters are not added.
The link will be created once you press “Enter” or click the “Submit” button.
The table of contents list will now include the anchor link. Your visitors will be taken straight to that header in the post or page’s contents when they click this link.
These procedures can be repeated to include anchor links for the table of contents’ other headers.
We trust that this guide has shown you how to add a table of contents to WordPress posts and pages.