question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support hreflang attribute

See original GitHub issue

For SEO we like to support the hreflang link attribute, so that alternative pages in different markets and languages can be exposed to crawlers. This is useful for crawlers so that they can offer the right page to the end user.

There are various issues with creating different links to the same content in other sites/languages.

  • Markets and languages are mixed and used in various ways to build URL. Some customers use different domains to differentiate markets, where others use a single domain and use market and language route parameters. Spartacus is likely not aware of the different domains per market as the /basesites API does not expose this.
  • Not all pages exists in all languages. The product assortment might vary, the navigation might differ or some (content) pages might not be available from market to market. This is often different in a single site that has a language selector.
  • The actual links might be localized. I.e. product pages often have the (localized) product name in the title.
  • Unstructured (cms) content cannot be connected by page labels. Often the page labels are localized, so that the linking cannot be automated. A CMS link would be required from page to page, which is not available in the CMS.

In order to build links to alternative lang/market variants, additional structure must be provided from the backend. As long as this structure is not in place, Spartacus can allow to introduce to resolve alternate pages, but cannot provide a default implementation in most cases.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
andreas-beckercommented, Nov 8, 2021

Hey @tobi-or-not-tobi or @Xymmer any improvements on this?

1reaction
danielbickelcommented, Aug 20, 2019

Besides the mentioned hreflang tag which should be made possible, there are also more SEO functionalities Spartacus should respect:

• Sitemap.xml • Schema.org • Canonicals (where hreflang comes into play but not only hreflang)

… and of course for every site, as multi-domain/country is a regular use-case for such commerce systems.

As storefront is not aware of the different (related) sites, this has to be done before I think.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What are Hreflang Tag Attributes And How To Implement Them
The HTML hreflang attribute (commonly mistaken as a "tag") tells search engines what languages your content is written in to help same-language speakers ......
Read more >
Hreflang: The Easy Guide for Beginners - Ahrefs
Hreflang is an HTML attribute used to specify the language and geographical targeting of a webpage. If you have multiple versions of the...
Read more >
Hreflang Attribute 101 - SEMrush
Hreflang is an HTML <link> or <link> tag attribute that tells search engines the relationship between pages in different languages on your ...
Read more >
HTML a hreflang Attribute - W3Schools
Definition and Usage. The hreflang attribute specifies the language of the linked document. This attribute is only used if the href attribute is...
Read more >
Implementing hreflang Attributes - Smartling Help Center
The hreflang attribute allows you to show search engines what the relationship is between web pages in alternate languages. This becomes an important...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found