Skip to main content
All CollectionsSpaceTemplates
Space: Using the article template
Space: Using the article template
Thomas K avatar
Written by Thomas K
Updated over a week ago

Summary


The article template showcases the content of a blog post.

Showing a table of contents


Create metafield definition

  1. Navigate to Settings > Custom data > Blog posts

  2. Click Add definition

  3. In the name field type “Table of contents”

  4. Ensure the namespace and key field is custom.table_of_contents

  5. Click Select type and select "Single line text"

  6. Select List of values

  7. Click save

Update metafield values

  1. Navigate to the blog post you’d like to update

  2. Scroll to the bottom and click Show all next to metafields

  3. Enter in values for each heading you want to appear in your table of contents

Add block

  1. In the Shopify theme editor navigate to the blog post template

  2. Click Add block under Article main

  3. Search and select "Table of contents"

Update headings

  1. In Shopify navigate to the blog post you'd like to update

  2. Click the "Show HTML" icon on your blog content

  3. Add id="HEADING-NAME" to your heading tags

    1. The id attribute should match the table of contents

    2. 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

    3. The heading tags should now look like this

      <h1 id="your-heading-text">Your Heading Text</h1>

Did this answer your question?