Add in page navigation to CMS item automatically?

Hi there, I was wondering if it’s possible to somehow improve a CMS-powered page template to include a sub navigation based on the page headings? Something like this page has: https://ahrefs.com/blog/how-to-get-on-the-first-page-of-google/

Does anybody know if this is possible by any chance?
The menu on the left, generated with a CMS item:

Are the page headings part of rich text or individual CMS items?

Hi Sarwech,

Thanks for reaching out! They are part of rich text.
Do you know how I can make this work?