# Table of Contents is not working with CMS richtext

**URL:** <https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083>\
**Category:** Attributes\
**Tags:** toc\
**Created:** [June 30, 2024, 7:01pm UTC](https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083 "2024-06-30T19:01:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![lissanh95](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/lissanh95/32/2527_2.png) [@lissanh95](https://forum.finsweet.com/u/lissanh95)\
**Post date:** [June 30, 2024, 7:01pm UTC](https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083/1 "2024-06-30T19:01:52Z")

</div>

I thought maybe TOC script runs earlier before Webflow render the CMS content. then I have put the TOC script before the body tag, but its also not working.

I have test the TOC Attribute with static richtext, its working. when I connect that richtext to CMS, TOC is not working.

---

<div class="post-metadata">

**Author:** ![Support-Luis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/support-luis/32/53_2.png) [@Support-Luis](https://forum.finsweet.com/u/Support-Luis)\
**Post date:** [July 1, 2024, 12:02pm UTC](https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083/2 "2024-07-01T12:02:00Z")

</div>

Hey @lissanh95! Can you please share a link?

---

<div class="post-metadata">

**Author:** ![lissanh95](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/lissanh95/32/2527_2.png) [@lissanh95](https://forum.finsweet.com/u/lissanh95)\
**Post date:** [July 1, 2024, 4:46pm UTC](https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083/3 "2024-07-01T16:46:11Z")

</div>

here is the read-only link:  
[https://preview.webflow.com/preview/appdealpage?utm\_medium=preview\_link&utm\_source=designer&utm\_content=appdealpage&preview=d69da8a9f6e9266064138d86410598f5&pageId=65424f8376bc50eb0656c190&itemId=668182b6e39d6e12d17075b1&locale=en](https://preview.webflow.com/preview/appdealpage?utm_medium=preview_link&utm_source=designer&utm_content=appdealpage&preview=d69da8a9f6e9266064138d86410598f5&pageId=65424f8376bc50eb0656c190&itemId=668182b6e39d6e12d17075b1&locale=en)

and here is the live link:

> **[Isaac Test Update Q2](https://app.dealpage.io/investor-update/663e86f440ce07925fa3f0db)**
>
> We're pleased to provide this update on our central Texas project. Despite recent heavy rainfall, we've made significant progress on foundational work and are moving forward with key design elements. Our team remains focused on executing our vision...

---

<div class="post-metadata">

**Author:** ![lissanh95](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/lissanh95/32/2527_2.png) [@lissanh95](https://forum.finsweet.com/u/lissanh95)\
**Post date:** [July 1, 2024, 5:04pm UTC](https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083/4 "2024-07-01T17:04:06Z")

</div>

TOC atrribute script adding IDs to richtext but not creating link elements. so I added my code to create link elements according to the richtext IDs.

---

<div class="post-metadata">

**Author:** ![lissanh95](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/lissanh95/32/2527_2.png) [@lissanh95](https://forum.finsweet.com/u/lissanh95)\
**Post date:** [July 1, 2024, 5:05pm UTC](https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083/5 "2024-07-01T17:05:57Z")

</div>

TOC attribute script also working in other pages with CMS richtext. not sure why its not working in this page.

---

<div class="post-metadata">

**Author:** ![Support-Luis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/support-luis/32/53_2.png) [@Support-Luis](https://forum.finsweet.com/u/Support-Luis)\
**Post date:** [July 2, 2024, 5:13pm UTC](https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083/6 "2024-07-02T17:13:50Z")

</div>

Hey @lissanh95! Sorry for the delay! I see the ToC is working as it should. Did you have to add anything on top?

---

<div class="post-metadata">

**Author:** ![lissanh95](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/lissanh95/32/2527_2.png) [@lissanh95](https://forum.finsweet.com/u/lissanh95)\
**Post date:** [September 27, 2024, 8:17am UTC](https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083/7 "2024-09-27T08:17:12Z")

</div>

I know why its not working. So basically I was using richtext editor on the front-end which sending the content to the CMS richtext field.

So I have checked the HTML, structure was totally different then normal richtext HTML structure. Thats why attribute was not working so I have manage to fixed that.

---

<div class="post-metadata">

**Author:** ![Support-Luis](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/support-luis/32/53_2.png) [@Support-Luis](https://forum.finsweet.com/u/Support-Luis)\
**Post date:** [September 27, 2024, 2:20pm UTC](https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083/8 "2024-09-27T14:20:44Z")

</div>

Thanks for the update! Could you share if there was any special setup? Is any extra code needed?

---

<div class="post-metadata">

**Author:** ![lissanh95](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.finsweet.com/lissanh95/32/2527_2.png) [@lissanh95](https://forum.finsweet.com/u/lissanh95)\
**Post date:** [September 28, 2024, 9:18am UTC](https://forum.finsweet.com/t/table-of-contents-is-not-working-with-cms-richtext/3083/9 "2024-09-28T09:18:48Z")

</div>

I am using [Tinymce](https://www.tiny.cloud/) Editor to send richtext content to Webflow CMS. so if the content structure is something like this:

```auto
<h2>Heading 1</h2>
<div><h2>Heading 2</h2></div>

```

I think TOC attribute code can detect the 1st H2, it will not the detect other headings which are in the DIV.

So when using TinyMCE, I am checking we dont have any parent DIV for heading content.
