I'm working on a multilingual website (Spanish and English, default is Spanish). I'm using the SEOmatic plugin, and I see that it generates this code:

<link rel="alternate" hreflang="es" href="http://localhost:8888/cmml/contacto" />
<link rel="alternate" hreflang="en" href="http://localhost:8888/cmml/en/contact-us" />

And I'm wondering if, instead of linking to the home page in an alternate language is there a way to link to the same resource in the alternate language?

Is there an easy way to achieve this? Thanks folks.


Both SEOmatic for Craft 2 and SEOmatic for Craft 3 have built-in functions to give you these URLs. I'm not sure which you are using so...

For Craft 2: https://github.com/nystudio107/seomatic/wiki/15.-Utility-Filters-&-Functions#getlocalizedurls

For Craft 3: https://github.com/nystudio107/craft-seomatic#helper-functions-seomatichelper

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.