How to create dynamic anchors (content menu links) within each CMS Collection item (blog post)?

@pavelkotlykov in case you’re still interested, I figured out a reasonably easy way to make this work:

I’m using two different Collection Lists, one for the table of contents/navigation, another for the content of the post itself.

The secret is to use an HTML Embed element to create the dynamic links, since Webflow does support embedding dynamic fields into these elements. Here’s how it works:

1. Create anchor links in your CONTENT Collection List:

Basically, instead of grabbing an off the shelf link element, we’ll use an HTML embed element and build our own link.

Here’s the code to create the anchor link:

Notice the list of fields in the top right of the code editor window.

2. Create navigation links in your TABLE OF CONTENTS Collection List:

Now, we’ll repeat the process for the nav links, but instead of using dynamic fields to create a link ID, we’ll use them to set the HREF attribute of the link:

And here’s the code:

Hope this helps you or the next person! I banged my head against this one for a while…:slight_smile:

5 Likes