if someone can help me to get a url dynamically in a twig (base.html.twig) but for the alternative version of the current page link for SEO purposes.
The website is using two languages /ar and /fr, when the french version is loaded the website has to show the link of the arabic version as alternative :
loaded page url : https://website.com/fr
hreflang tag : <link rel="alternate" hreflang="ar" href="https://website.com/ar">
I'm not good in coding, for the homepage I've tried this :
<link rel="alternate" {% if selected_lang == 'fr' %}hreflang="ar"{% else %}hreflang="fr"{% endif %} {% if selected_lang == 'fr' %}href="https://website.com/ar"{% else %}href="https://website.com/fr"{% endif %}>
But I need a solution to get the url for all pages, like adding a variable after /fr/... or /ar/...
is there any way to do it within a html twig?