# Generate table of contents from article

**URL:** <https://forum.seocontentmachine.com/t/generate-table-of-contents-from-article/68>\
**Category:** feature\
**Tags:** done\
**Created:** [January 31, 2024, 6:08am UTC](https://forum.seocontentmachine.com/t/generate-table-of-contents-from-article/68 "2024-01-31T06:08:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim](https://forum.seocontentmachine.com/user_avatar/forum.seocontentmachine.com/tim/32/486_2.png) [@Tim](https://forum.seocontentmachine.com/u/Tim)\
**Post date:** [January 31, 2024, 6:08am UTC](https://forum.seocontentmachine.com/t/generate-table-of-contents-from-article/68/1 "2024-01-31T06:08:24Z")

</div>

1. The problem  
The TOC is generated first and then sub headings are inserted.

If existing article already has headings then those will no appear inside the TOC.

1. Simple solution  
Parse the article and create a TOC on demand.

---

<div class="post-metadata">

**Author:** ![Tim](https://forum.seocontentmachine.com/user_avatar/forum.seocontentmachine.com/tim/32/486_2.png) [@Tim](https://forum.seocontentmachine.com/u/Tim)\
**Post date:** [April 28, 2026, 6:54pm UTC](https://forum.seocontentmachine.com/t/generate-table-of-contents-from-article/68/2 "2026-04-28T18:54:53Z")

</div>

TOC generation is now dynamic and reads from the generated article.

It even generates a nested TOC

This means TOC works for AI articles, even without needing to insert headings.

Also removed some footprints. ie colors etc. Instead its class name is TOC, so you have to style it with your site theme.

The links to each heading is now using slug instead of toc#nnn.

Less footprints using this dynamic version.

 ![image](https://forum.seocontentmachine.com/uploads/default/original/2X/7/7ce2617b3f0b24f458c801cf841fc9819cef7faf.png)

 ![image](https://forum.seocontentmachine.com/uploads/default/original/2X/a/a26fc38421b41ad302cfce38064c5e4b68762041.png)
