You can use plugins to add a table of content to your WordPress website. If you love to play around with some tech, here is how to add a table of content without plugins.
Else, see lesson 3, where I highlighted five plugins for your table of contents.
I will use the block editor for all demonstrations in the demonstration below. If you are using the classic editor, I strongly advise moving to the block editor. It is more robust and easier to use.
Below are the significant steps we will take
- We will select the article you want to add a heading to
2. We will select the headings that we want in the table of content. I want to believe you have articles that have headings. If your articles do not have headings, kindly first create headings for each section of your articles. In my training titledhow to use headings for SEO, I explained how to use headings.
Go to the first heading block and move your mouse around it. A toolbar will appear. Select the three dots indicating the more option. Then select the edit as HTML option as shown in the image below.
We will open the tag and add unique identifiers to them. Below is a screenshot showing how I added a unique identifier to my header. I named it "create-1". I will do the same thing to other headers of my choice. Below are screenshots showing three other headers that I have attached—unique identifiers with the intention that they will form a part of my table of content.
First
Second
Third
After placing unique identifiers on the headers, Locate where you want your table of content. We are going to create a custom HTML block at that location. I always want my TOC to appear before my first H2 heading, so I will create my custom HTML block as shown below in my desired location.
I will create jump links with the code below in my custom HTML block. Note that I have spelled it out as TOC with a div tag and denoted it as an ordered list.
Here is what your code should look like.
That's a good selection of options! There's been a lot of development with various TOCs over the last year or so.
Personally I prefer Kadence blocks... Create A Table Of Contents Using Kadence Blocks :-)
Richard