I was referring to this documentation, but am unsure if what I'm trying to do is possible: https://www.drupal.org/docs/8/theming/twig/functions-in-twig-templates#path

In the section, it refers to this on building a URL:

{# Link to node page. #}
<a href="{{ path('entity.node.canonical', {'node': node.id}) }}">{{ 'View node page'|t }}</a>

This returns a TRULY relative URL, in the sense that if I'm on an English node, the URL is translated to english. If on a Spanish page, the URL is translated. The thing is, I'm trying to create a link in the nodes to the OTHER language, so I need to be able to create unique links for each language in the opposing language's TWIG.

Anyone know of a way to get this URL in a language-dependant manner?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.