Anchor to content element

Hi everyone,

is there a way to use the concept of anchors in Neos?
I would like to create a link from another page to a defined content element.
Example: By clicking the link, I’m directed to the new page and automatically scroll to the middle of the page where the defined content element is located.

Thank you

Hey @DanielOliver ,

you can extend the target elements inspector and add a input field where you can define a anchor name.

Edit the roots.ts2 ( add something like: anchorId = ${q(node).property(‘anchorId’)} )
Edit your template:

<f:if condition='{anchorId}'>
	<a name="{anchorId}"></a>

Now you have to use JavaScript.
Maybe this will help:

I hope this will help! :grinning:

1 Like

+1 for getting a solution in the core, I’ve had customers request this in almost every project.

1 Like