Hi @egr103
Without fully understanding your data and theme setup, I can’t be of much help, but I would guess that a jQuery solution is a pretty smart one.
This will then dynamically create the links based on the page’s content. It is actually the same logic that I use on the ACF docs page to create the ‘on this page’ links.
Hope that reassures you.
Cheers
E