Creating a well-organized Table of Contents (TOC) can enhance the readability and navigation of your longer WordPress posts and pages. The CAES Table of Contents block allows you to easily add a TOC to your posts based on the headings you specify. Here’s a step-by-step guide on how to use this block effectively.
Inserting the CAES Table of Contents Block
Step 1: Open the Post Editor
- Log in to your site.
- Navigate to the post or page where you want to add a Table of Contents.
- Click “Edit Post” (or “Edit Page”) to open the post in the block editor.
Step 2: Add the CAES Table of Contents Block
- Put your cursor where you would like to add the TOC. Click the plus (+) icon to add a new block.
- In the block search bar, type “CAES Table of Contents.”
- Select the “CAES Table of Contents” block from the search results to insert it into your post.
Add HTML Anchors to Headings
The CAES Table of Contents block generates a TOC based on the headings (H2-H6) that you assign HTML anchor tags to. Here’s how to add the anchor tags:
- Select a heading block in your post.
- In the block settings sidebar on the right, expand the “Advanced” section.
- In the “HTML Anchor” field, enter a unique identifier. Use dashes instead of spaces. Here are some examples of headings and their anchor tags:
- Heading: Introduction to Backyard Chickens
- Anchor: introduction
- Heading: Setting Up the Coop
- Anchor: setting-up-coop
- Heading: Egg Production
- Anchor: egg-production
- Heading: Introduction to Backyard Chickens
Repeat this process for all the headings you want to include in your TOC. The TOC will list these headings and indent subheadings under their respective parent headings.
Customizing the TOC Settings
The CAES Table of Contents block comes with a few customization options to tailor the TOC to your needs. You can access these settings in the block settings panel on the right-hand side of the editor when the block is selected.
List Style
- Choose between three list styles:
- Unordered List (default): Displays the TOC as a bulleted list.
- Ordered List: Displays the TOC as a numbered list.
- No Bullets: Displays the TOC without any list markers.
- To change the list style, select the desired option from the dropdown menu.
Show Subheadings
- This toggle determines whether subheadings (H3-H2) are displayed in the TOC.
- Default: On (subheadings are shown).
- To hide subheadings, switch the “Show Subheadings” toggle to off.
Smooth Scrolling
- This toggle enables smooth scrolling when a TOC link is clicked, providing a better user experience.
- Default: On (smooth scrolling is enabled).
- To disable smooth scrolling, switch the “Smooth Scrolling” toggle to off.
Finalizing and Publishing
After configuring the CAES Table of Contents block and adding anchor tags to your headings, you can preview your post to ensure the TOC functions correctly. Make any necessary adjustments, and once you’re satisfied with the setup, publish or update your post.
Need Help?
Do you have questions, or need help using the CAES TOC block? Reach out to the Web Team at caesweb@uga.edu for assistance.