MODX Community

How do I include a same-page anchor link in a Fred Element?

Hi. I’m experimenting with Fred. Love it so far but one thing is baffling me – how to use page resource tags in a Fred Element. To be more specific…

I’ve created a Fred template for a page with a hero banner and a Fred Element for the banner itself with various settings in the options. However, I also want to include a scroll-down link to target a named anchor further down the same page. I need the scroll-down link to be inside the Element and I want it hardcoded, i.e. not editable.

I tried using the normal href="[[~[[*id]]]]#anchor" syntax in the Element HTML but what then renders is simply the base URL appended with [[~[[*id]]]].

How do I include a simple ‘dynamic’ same-page link in my Element? Please help!

Edit: I think the link might need to be in Twig syntax but I can’t figure it out!

Hi @whitmoa,

Welcome to the community!:wink:

Try this way:

[[~[[*id]]:after=`#anchor`]]

This might help you hopefully.
Cheers