Blog post language versions - canonical URLs


#1

Unfortunately, the Blog does not support translations. It's possible to simply make a blog per language, but this isn't really a translation; it's just two separate blogs.

I am thinking to use the canonical URL as a link to translated content (there are only two languages, so it works). I'd use JS or Hubl to do this.

Are there any drawbacks to this idea? It's not completely out of the scope of what a canonical URL does. I can't think of another way to do this which allows the content writers to intuitively manage language versions.


#2

Hi @friendofdog,

Just to make sure that we're on the same page, are you intending to use the canonical URL of page A to link to page B, and the canonical URL of page B to link to page A? If so, I don't believe that's the best course of action, since Google uses canonical URLs to determine the 'primary' piece of duplicate content. I think using two separate blogs (while perhaps not the most elegant) is likely your best best; you can host all translations of content on the exact same URL, except with a language slug (e.g. example.com/content-here vs. example.com/fr/content-here) making it easy to dynamically link between the two translations.

I look forward to hearing how other community members approached this issue!


#3

@Derek_Gervais, thanks for the reply. Yes, we're on the same page.

The solution you suggested would work, except that the slugs do not line up. Also, that would not generate the <link ref="alternate" hreflang="" /> tag usually found in translated content.

The only reason I thought to use canonical URL was because it's intuitive. (Me: "Put the translation in the canonical URL field." Marketer: "Got it!") I could create a database of translations elsewhere and use Hubl to render the appropriate links in the head and menu, but that is far too complicated and counter-intuitive.

But if content writers could enter the value for a custom variable as they're entering content, it should be easy to render that value in the markup. So I suppose that another way to ask this question would be, is there a way to dynamically set custom variable values as you're editing a blog post?


#4

Hi @friendofdog,

Yes, you should be able to add a HubL variable to a blog post template in the same way you would for other pages. After the module is added to the post template, marketers could edit the value; which would be accesible via HubL. I've included the HubL module docs below for some more context: