You can create custom JavaScript function: 1.which will read all h2 tag on document.ready 2. Create dynamic html with step-1 content 3. Add dynamic html into div 4.
- read all h2 tag on document.ready
- Create dynamic html with step-1 content
- Add dynamic html into div
You can use OOTB html snippet component to insert the JavaScript function or create custom JavaScript file and upload into theme.