1. Home
  2. Knowledge Base
  3. SEO Suite
  4. How to Add Rank Math’s Table of Contents Block?

How to Add Rank Math’s Table of Contents Block?

Have you ever stopped reading an article because it was too long, you got bored, or you couldn’t find the section you were looking for? This might not have happened if the author had included a table of contents.

Agree?

But you need not worry. We’re always looking for ways to make your work easier. One of the tools that can help you improve the readability of an article is a table of contents located at the top of the page.

Rank Math makes it extremely simple to add a Table of Contents block to your article without hassle. In this knowledgebase article, we’ll show you how to create a TOC block using Rank Math.

How to Add a Table of Contents For Your Articles

1 Add TOC Block Using Rank Math

1.1 Install and Activate Rank Math

First, install and activate the Rank Math plugin on your site. We recommend using Rank Math as it saves you time by automatically generating the table of contents based on your headings and making it completely customizable with editable links.

Upon activation, you’ll need to configure the plugin using the Rank Math setup wizard. For detailed instructions, see our guide on correctly setting up Rank Math for WordPress.

Once you’ve installed and configured the plugin, adding a TOC block using Rank Math is a pretty simple process.

1.2 Adding Table of Contents Block

Navigate to your post/page editing screen where you wish to add the table of contents. In the post-editing screen, click the ‘+ ‘ icon and locate the Table of Contents by Rank Math block.

Select Table of Contents by Rank Math block

Once you’ve added the Table of Contents by Rank Math block, add a title for your table of contents. Next, Rank Math will automatically generate TOC from the post’s content.

Add title

The plugin automatically identifies the headings on the page and adds them to your table of contents, linking to the corresponding sections within your post or page. If you use different heading tags (say H2 and H3), lower-level headings will be indented to show the structure of your content.

For instance, if you start with an H2 Heading block and then add an H3 to H5 below it, these will get incrementally nested and added as sub-headings, as shown below.

Headings in Table of Contents Block

Rank Math automatically includes the SiteNavigationElement Schema for the headings added to the Table of Contents block.

Automatically added SiteNavigationElement

2 Customizing Table of Contents Block

Rank Math’s Table of Contents Block includes several options to help you customize the table of contents to suit your needs. Let’s discuss them in detail.

2.1 Edit Headings in TOC Block

Our Table of Contents block is also completely editable. For instance, if the heading in the article is too long, you can consider having a trimmed version in the Table of Contents block by directly editing it in the Table of Contents block, as shown below.

Editable Table of Contents

2.2 Hide Headings in TOC Block

You can click the eye icon next to the headings if you wish to hide a certain heading.

Hide the headings

The plugin also adds the anchor links to the headings automatically. If you wish to change the anchor links, you can always do so by clicking on the Link icon, as shown below.

change anchor links

But please note if you’ve already set your own anchor link, then we don’t change it.

Anchor Links set

When visitors click a link in the table of contents, they’ll be immediately navigated to that particular heading in the post or page. This allows users to jump to the section they’re most interested in without wasting time.

Anchor link preview

2.4 Alignment

The Align option sets the alignment for the table of contents. Available options are: None, align left, align center, align right, wide width, and full width.

Changing alignment in TOC block

2.5 List Style

The List option lets you choose a list style for your table of contents. You can choose a bulleted or numbered list style for your table of contents or choose none if you do not want to set any list style.

Changing List style in TOC block

3 Table of Contents Block Settings

When you select the Table of Contents block, the following settings appear in the Block section, as shown below.

Bock settings

Let’s discuss each one of them in detail.

3.1 Title Wrapper

This setting sets the HTML tag you want to use for the title. Available options are H2-H6, P, and DIV.

Title Wrapper

3.2 Exclude Headings

This setting lets you choose the heading tags you don’t wish to include in the TOC block. Available options are Heading H1-Heading H6.

Exclude Headings is also available under the Global settings, discussed in the later section. You may see some of these options might be checked already based on what you’ve configured under the Global settings.

Exclude headings

3.3 Color

This setting lets you choose the color for the text and background. You can either select from your theme colors or any other specific color of your choice or add a gradient.

For instance, you can set the Text color, as shown below.

Add text color

You can set Background color, as shown below.

Change background color

If you wish to customize the background color further, click on the control points that control the color on the left and right and add the Hexadecimal code of the color, as shown below. You can also adjust the angle of the color as per your preference.

Add color control points

You can set the color of the link, as shown below. To do so, click the Link section, and set the color of the link, as shown below.

Set the color of the link

If the Link color option is not available then its probably due to the theme not supporting the feature. You can try using the default themes or contact the theme developer to further add the feature.

If you wish to remove the Text, Background, or Link color settings from your Table of Contents, click the Color options (three dots) and the ‘-‘ sign to remove a particular setting, as shown below.

Remove a particular color setting.

If you wish to reset all the Color settings, click the Reset all option, as shown below.

3.4 Typography

This setting lets you change the font size and line height. You can choose from the available sizes like Small, Medium, Large, Extra Large, and XXL. You can use the up and down arrows to increment or decrement the line height.

Typography settings

You can also set a specific value by clicking the slider icon and also change the units, as shown below. The choices are pixels, em, or rem.

set a specific size

To remove the Font size setting, click on the Typography options (three dots) and then the ‘-‘ sign, as shown below.

Remove the Font size setting

To reset all the Typography settings, click the Reset all option, and all your Typography settings will reset.

Reset all Typography settings

3.5 Dimensions

This setting lets you add padding and margin to your Table of Contents. Padding is the area between an element’s border and its content, whereas a margin is an area around an element’s border. In other words, the padding controls the spaces inside the block, and the margin controls the spacing outside it.

To add Padding and Margin, click the ‘+’ sign, and select the dimension you want to change.

Dimension settings

You can then change the padding and the margin for your Table of Contents, as shown below.

Dimensions settings

To set a custom padding and margin, click the slider icon and set a specific value. You can choose a unit from the available options.

set custom dimensions

If you wish to add padding and margins at various locations such as the Top, Right, Bottom, and Left of your Table of Contents, click on the Link sides sign and set padding and margin as per your preference. You can also set a specific value to the padding and margins by clicking the slider icon.

Set Padding and Margin on all sides

To reset all the Dimensions settings, click the Reset all option. Doing so will reset all your Dimensions settings.

Reset all Dimensions setting

3.6 Advanced CSS Classes

This setting lets you customize the appearance of the TOC block by using CSS classes. You can also directly customize the CSS of the Rank Math Table of Contents block sitewide by adding CSS rules for #rank-math-toc.

Advanced CSS classes

4 Table of Contents Block Global Settings

To customize the TOC Block settings, navigate to Rank Math > General Settings > Blocks, as shown below. The Blocks settings are available only when you enable the Schema (Structured data) module.

Customize TOC Block settings

You can customize the following TOC options from here:

4.1 Table of Contents Title

Add the default title for your Table of Contents. But that said, you can always override this default title on a post level.

Table of Contents Title option is visible in the Advanced version of Rank Math. If you don’t see this option, ensure that you’re using Advanced Mode of Rank Math.

Table of Contents Title

4.2 Table of Contents List style

Choose the default list style from the drop-down menu. Available options are None, Numbered, and Unordered.

4.3 Table of Contents Exclude Headings

Select the headings you wish to exclude from the Table of Contents.

Once you’ve made changes, click the Save Changes button to save your settings.

5 Create a Reusable Table of Contents Block

Once you’ve created and configured the Tables of Contents block, you can save the customized Table of contents block as a Reusable Block.

The Reusable block allows you to save any content block and reuse them in other posts and pages on your website. Hence you don’t have to style them every time, thereby saving you time.

To save your Table of Contents as a Reusable block, select the Table of Contents and click on Create Reusable block, as shown below.

Create Reusable TOC Block

Next, add a name to your Reusable block and click on the Save button.

Add a name to Reusable block

And that’s it! You can now reuse your Table of Contents block in other posts and pages, as shown below.

Reusable TOC block created

6 Convert Table of Contents Blocks from Yoast / AIOSEO to Rank Math

If you’ve existing Table of Contents blocks from Yoast/AIOSEO, and decide to migrate to Rank Math SEO, the plugin handles it in a breeze.

When you set up Rank Math for the very first time using the Setup Wizard, Rank Math can automatically import these blocks.

Imported Table of Contents block

If you’re yet to import these blocks from AIOSEO/Yoast SEO, you can always do that by navigating to Rank Math > Status & Tools > Database Tools. Here you’ll see Yoast Block Converter for Yoast SEO (or AIOSEO Block Converter for AIOSEO).

AIOSEO convert block

Click on the Convert Blocks button, click OK on the confirmation message, and the block will automatically be converted to Rank Math’s Table of Contents.

click Ok in the confirmation message

6 Conclusion

A table of contents improves your SEO and makes it easier for your readers to navigate your content, allowing them to read exactly what they want. Following this step-by-step guide, you can add a Table of Contents by Rank Math to your WordPress posts and pages.

If you still have questions regarding the Tables of Contents – you’re always more than welcome to contact our dedicated support team. We’re available 24/7, 365 days a year…

Was this article helpful?

Still not using Rank Math?

Setup takes less than 5 minutes including the import from your old SEO Plugin!

Learn more about the PRO Version

Still need help?

?

Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket

Related Articles