Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Get current full link or anchor link with twig

Solved by Aaron Dalton View solution

Started by Marc Rimkus 8 years ago · 2 replies · 1772 views
8 years ago

What I want to do:

  • Twig checks url if there is an anchor link included.
  • If there is an anchor link twig changes some meta informations.

Problem:

  • Can´t find a way to retrieve the url WITH the anchor.

So my question. Is there any way I can retrieve the full url with twig to get the anchor or is there even a option to get the anchor information directly?

8 years ago Solution

The URL fragment is never sent to the server, so Grav can't know it. You need client-side JS to access it. This is by design.

8 years ago

Oh ok thank you for your fast response!
Then JS it will be.

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 56 13 hours ago
Support · by Anna, 3 days ago
2 61 16 hours ago
Support · by Justin Young, 17 hours ago
1 32 17 hours ago
Support · by Duc , 1 week ago
2 66 5 days ago
Support · by Colin Hume, 1 week ago
2 59 5 days ago