Hi team,
I want to implement a a fully structured JSON-LD schema for our About page but not familiar with the code editor and I do not want to break anything. The instructions I have are the followng:
Implementation in Shopify
-
Go to Shopify Admin → Online Store → Themes → Edit Code → theme.liquid
-
Paste the JSON-LD <script> just before the closing </head> tag.
-
Save the theme.
-
Repeat for French Canadian version if you have a multi-language store (or wrap in conditional Liquid code for locale).
Also not sure how to implement the French version (we use Translate and Adapt).
Can someone confirm this is the right way to do so and provide more guidance?
Thanks in advance!
Martin
Hey there,
I think adding page-specific JSON-LD to `theme.liquid` isn’t the best approach because it’ll inject that schema across your entire site, not just the About page. You want to make sure it only renders where relevant.
The cleaner way to do this is to either:
- Create a dedicated snippet: Make a new snippet file, say `json-ld-about-page.liquid`, and paste your schema there. Then, in your `page.liquid` template, you’d add an `{% if page.handle == ‘about-us’ %}` (adjust `about-us` to your About page’s handle) and include the snippet `{% render ‘json-ld-about-page’ %}` within the section. This keeps your main `page.liquid` clean.
- Directly in `page.liquid`: If you only have one `page.liquid` template, you can paste the schema directly into `page.liquid` within that `if page.handle` block, also within the `` section.
For the French version using Translate and Adapt, you’d wrap your JSON-LD within a Liquid conditional. So, for example:
```
{% if page.handle == ‘about-us’ %}
{% if request.locale.iso_code == ‘fr’ %}
{% else %}
{% endif %}
{% endif %}
```
This way, the correct schema loads based on the current locale and only on your About page. You’ll need to make sure your About page is using the default `page` template, or if you’ve created a custom template for it, put this code in that specific template file.
Hope that helps!
Hey Martin,
Yes, adding the JSON-LD to theme.liquid just before is the correct standard method for Schema that should load on all pages (including about).
But since this schema is only for the About page, you should wrap it in the condition to that it just apply for the About us page only, not the other pages.
You have to follow these steps, in order to implement it.
Go to Shopify Admin >> Online Store >> Edit Code >> theme.liquid
In the end of theme.liquid paste the following code that shared below.
{% if template.name == 'page' and page.handle == 'about' %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "AboutPage",
"name": "About Us",
"description": "Your about page description goes here.",
"url": "{{ shop.url }}/pages/about",
"publisher": {
"@type": "Organization",
"name": "{{ shop.name }}",
"url": "{{ shop.url }}"
}
}
</script>
{% endif %}
Page handle might be different than the About or based on your page title.
Or you can share the store url here, so that I can find the exact page handle.