5

I'm working on a website which has different content depending on the province/state the user is from.

Is it valid to add the subdivision code to the hreflang like below?

<link rel="alternate" hreflang="en-ca-ab" href="https://www.example.com/ca/ab/example/"/> 

If not, is there another way to let search engines know that the content is specific to a certain province/state?

  • 1
    The hreflang format doesn't allow for subregions unfortunately support.google.com/webmasters/answer/… – jrtapsell Jul 4 '18 at 18:16
  • Do you know if there is an alternative that can be used? – Brad Thiessen Jul 4 '18 at 18:17
  • 1
    @jrtapsell I do not think the Google link gives the real definition of a language tag, it just gives the simplified version when you have only language and optionnally region. But a language tag, per BCP47, is far more complex. – Patrick Mevzek Jul 4 '18 at 21:42
3

In short, no. The "Supported language/region codes" section of Google's hreflang guidelines is fairly unambiguous:

The value of the hreflang attribute identifies the language (in ISO 639-1 format) and optionally the region (in ISO 3166-1 Alpha 2 format) of an alternate URL.

The use of the word "region" there is perhaps confusing. ISO 3166-1 Alpha 2 codes denote countries1.

What you probably want to do is known as local SEO, which relies more on content and off-site optimisations to target search queries with local intent. It's beyond the scope of your question to cover that here.


1 To be really pedantic, even this is semantically troublesome. For instance, the constituent countries of the UK don't have their own codes, even though they are countries (not states or provinces).

1

The HTML5 specification defines hreflang like this:

The hreflang attribute on a elements that create hyperlinks, if present, gives the language of the linked resource. It is purely advisory. The value must be a valid BCP 47 language tag. [BCP47] User agents must not consider this attribute authoritative — upon fetching the resource, user agents must use only language information associated with the resource to determine its language, not metadata included in the link to the resource.

(see https://www.w3.org/TR/html5/links.html#attr-hyperlink-hreflang)

BCP47 is IETF document "Tags for Identifying Languages". It details how a language tag is formed and its possible content.

The parsing is basically language[-script][-region]*("-" variant)*("-" extension):

  1. the first part is the language as defined in ISO 639-1 Alpha-2 codes, so en from your case, with optional extended language subtags,
  2. the script is 4 characters, so not your case here (it is optional),
  3. the region is from ISO 3166-1, country codes, and it is preferred to be in uppercase, hence CA,
  4. variant subtags are defined as used to indicate additional, well-recognized variations that define a language or its dialects that are not covered by other available subtags. but they are at least 4 characters (see point 4 of 2.2.5)

So en-ca-ab does not seem valid to me. The ISO 3166-2 code for Alberta in Canada is "CA-AB", but you can not use it as a variant as is (because of its hyphen and because each variant is registered in a registry).

In fact if you input your string at http://unicode.org/cldr/utility/languageid.jsp you will see it is labeled as invalid. I also see no registration for "Alberta" in https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry

In short, do you really think/need to define the English Canadian language as spoken in Alberta because it is so different from English Canadian, which would be the valid en-CA language tag?

Remember that you are identifying a language, not a geography. If you want to specify that part of your website is related only to this specific province (for example if you provide services only there), then it is not a language issue, and hence should have nothing to do with hreflang.

  • According to Google, (who introduced the hreflang attribute) the purpose of the hreflang tag is "for language- or region-specific pages". So I think it's more than just language but also minor differences in the content. – Brad Thiessen Jul 5 '18 at 4:32
  • 2
    @BradThiessen the region is there to denote a language as spoken in a specific region, it is not used to specify the region as a geographic area, only a language. This is why the attriibute is called hreflang and not hrefgeo or something like that. – Patrick Mevzek Jul 5 '18 at 4:43
1

In terms of hreflang you can't specify your content more detailedly as with the schema of language and country.

I would however highly recommend to make use of structured data, specially https://schema.org/audience and https://schema.org/spatialCoverage. With both properties you are able to communicate the covered region very exactly.

The question, which remains for me without an answer, is: how do you technically deliver different content to different regions? IP-based? Is it working enough precisely for you?

  • We only filter IP based on country, and then give options to the user to pick based on their region. However, the vast majority of users visit these region specific links directly from Google/Bing, so it would be nice to have search engines show the correct link based on the user's province/state. I will look into the structured data, though. Thanks for that! – Brad Thiessen Jul 9 '18 at 16:23
  • @BradThiessen i can't recommend enough often to use management schema offered by Google for guiding users to their region's content: news user comes→you ask about his region→users answers→you set a cookie with selected region. On next visit→user goes to those region content he selected previously and saved with a cookie. No automatic redirect without user's manual selection and saving a cookie with his selection! In case of cookie-less automatic redirect you risk that Google ranks mainly the region with most redirects. – Evgeniy Jul 9 '18 at 20:42

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.