Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

Alternate Url's for the different languages

Started by Muut Archive 11 years ago · 1 replies · 433 views
11 years ago

Hi All, I have SEO related question. Is their a nice way to get all the alternative url's for the different languages of a page? I would like to set the different alternate link tags in the head of my page if they are available (for optimal SEO).

--- html
<link rel="alternate" href="http://example.com/de" hreflang="de" />
<link rel="alternate" href="http://example.com/nl" hreflang="nl" />

TXT


The simple solution would to be guess the url's by simply prepending the language identifier. But that could create problems if the translation is not available.
11 years ago

In a Twig file try page.translatedLanguages (from the API). It's an array so you need to loop over it.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Muut Archive, 10 years ago
1 673 1 week ago
Archive · by Deleted User, 9 years ago
0 3043 9 years ago
Archive · by Muut Archive, 9 years ago
2 1983 9 years ago
Archive · by Muut Archive, 9 years ago
2 5337 9 years ago
Archive · by Muut Archive, 9 years ago
1 4134 9 years ago