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

Alternate Url's for the different languages

Started by Muut Archive 10 years ago · 1 replies · 315 views
10 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.
10 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 Deleted User, 9 years ago
0 1354 9 years ago
Archive · by Muut Archive, 9 years ago
2 935 9 years ago
Archive · by Muut Archive, 9 years ago
2 4064 9 years ago
Archive · by Muut Archive, 9 years ago
1 2951 9 years ago
Archive · by Muut Archive, 9 years ago
3 1119 9 years ago