Create metafield definition
- Navigate to Settings > Custom data > Blog posts
- Click Add definition
- In the name field type "Table of contents"
- Ensure the namespace and key field is
custom.table_of_contents - Click Select type and select "Single line text"
- Select List of values
- Click save
Update metafield values
-
Navigate to the blog post you'd like to update
-
Scroll to the bottom and click Show all next to metafields
-
Enter in values for each heading you want to appear in your table of contents
Add block
- In the Shopify theme editor navigate to the blog post template
- Click Add block under Article main
- Search and select "Table of contents"
Update headings
- In Shopify navigate to the blog post you'd like to update
- Click the "Show HTML" icon on your blog content
- Add id="HEADING-NAME" to your heading tags
-
The id attribute should match the table of contents
-
For example, you click a table of contents link you'll notice the URL bar is updated - this will give you the value that is needed for your id attribute
-
The heading tags should now look like this
text <h1 id="your-heading-text">Your Heading Text</h1>
-




