Get current full link or anchor link with twig

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.


  • 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?

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.

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