1

Our team want to create one or two landing pages that are translated and localized e.g. Spanish and Portuguese

This won't be a full site translation, so it doesn't deserve a subdomain or subfolder, just two pages.

Looking at best practices from Google, and wondering are there Craft implementation best practices for:

  1. Defining hreflang
  2. Changing the HTML language attribute (so not lang="en")

We are using SEOmatic in case that is useful info.

2 Answers 2

5

Another way you could do this - that wouldn't be sustainable to expand later - is to create two landing pages as singles in Craft CMS.

Then, create a new template for wherever you keep your header info (layout.twig usually) with all of the correct hreflang etc. in the header and include that layout template with the associated entry templates.

Give these two templates a route such as domain.com/es/slug (you should be able to do this directly in the singles setup page within the CMS).

This will create the effect you want, but without committing to a full multi-site. I emphasize again that this method does not scale well. But for an interim it should work fine. Remember to make your SEO values for these entries in the correct language. Best of luck!

1

I would still recommend to create an additional site with a different language setting in Craft (Settings > Sites).

I recommend sharing one section between the 2 sites (pages?). Make sure, the propagation method is set to not automatically propagation entries to all sites. Make sure the fields that need to be translated are enabled for translations and that they are not automatically enabled.

Then create the entries for your additional site/language by either creating new/standalone entries or create translations of existing entries.

2
  • Thanks for the response. This makes sense but also sounds like too much for something that may not last e.g. we try it then determine not to maintain it. So I know the tradeoffs, what would be the downside of creating a separate page, inserting hreflang (via an HTML field) and just keeping the language attribute as english?
    – Lee
    Commented Mar 1, 2023 at 14:36
  • Nothing. Craft is flexible, so it would work. But what I described is a matter of minutes, so why go the wrong way… Commented Mar 2, 2023 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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