JSON LD Schema does not work on international pages

Hello everyone,

My JSON LD schema markup works great on my domestic pages and has been validated with Rich Results Test / Schema.org validator.

However, once I go to an international version of a page on my website (subfolder directory - example.com/en-au/ ), the Schema is no longer populating the page HTML nor is it showing up in validators.

What’s happening here?

To explain my set up further:

  • I create JSON LD schema in a snippet
  • I render said snippet in relevant section from which snippet is pulling dynamic values
  • Rendering is based on tail end of page path, well beyond the subdirectory path
  • All my subdirectories are in english

Appreciate any insight! Thanks

Well for anyone having this issue, I have solved it myself. I was rendering the snippets incorrectly based on page path.

For example:

Incorrect:

{%- if request.path == '/collections/mens-shoes' -%}
 {% render 'schema-mens-shoes' %}
{%- endif -%}

Correct:

{%- if request.path contains '/collections/mens-shoes' -%}
 {% render 'schema-mens-shoes' %}
{%- endif -%}

Notice in the correct example I use contains instead of ==

I incorrectly assumed that just leaving the tail end of page path would leave room for whatever sub-directory.

1 Like

Also see https://shopify.dev/docs/storefronts/themes/markets/multiple-currencies-languages

https://shopify.dev/docs/api/liquid/objects/localization

and request.origin etc https://shopify.dev/docs/api/liquid/objects/request#request-origin