I’m planning my site and want to know if I can include a sticky sidebar with section links on a CMS Collection Page template. The section links would link to different sections within a single rich text block from the CMS Item.
Similar to Webflow’s own Article collection page template which allows links with anchor tags direct to content within the article:
I recently asked some people about this and you can’t do it without custom code. If you search the forums you’ll find some custom code solutions but YMMV. I personally haven’t found a good way to do it.
Oof, thanks for posting this @Sai_Abhijith! I tried this in my project and it’s not working. Double-checked all the code (pasted below) and made sure my RTE was named properly and all titles were tagged as H4s and changed it to H4 in the code … What am I doing wrong here? Thanks for any guidance anyone can give!
Here’s a quick walkthrough video to show you the lay of the land:
Here’s my code that I transcribed from the screenshot:
<script>
//Select all H3 headings that are subset of class "blog-content" and name the set as sections
const sections=document.querySelectorAll(".articles-rte > H4");
//For each element in sections, set an id numerically starting from 1.
sections.forEach((section,i) => {
sections[i].id=`${i+1}`;
});
</script>
Hey @adiggy, I don’t think there is any mistake. The page is not scrolling because, the section is already in the visible area. Try linking to a heading which is out of page(I mean instead of #2, try #5 or #6). Let me know if you still face an issue.