Solved

Where is the structured data for products in the Dawn Shopify 2.0 theme?

Gunnar-
New Member
4 0 0

Hi There,

I'm currently migrating my store from the old Debut theme to the new Dawn theme, but I'm unable to find the structured data part for the products. Is there maybe a reason this is no longer needed, or has it moved outside of the theme code?

Your help would be much appreciated, thank you.

Accepted Solution (1)
drakedev
Shopify Partner
685 148 229

This is an accepted solution.

Hi @Gunnar- 

structured data is not deprecated and still very important for Google and other search engines, Facebook, etc.

Dawn has been built from scratch and at the moment they are focused on the essential features. Could be that they will decide to add that part in future.

If my answer was helpful click Like to say thanks
If the problem is solved remember to click Accept Solution
Shopify/Shopify Plus custom development: You can hire me for simple and/or complex tasks.

View solution in original post

Replies 11 (11)

Henry_dev
Shopify Partner
105 19 35

Hi @Gunnar- 

You can see the instructions at this link: https://shopify.dev/themes/migration

Gunnar-
New Member
4 0 0

Hi @Henry_dev ,

Thank you for your quick reply, however, this guide does not mention the structured data of the old product template from Debut and it's nowhere to be found in the new Dawn theme, so it's not really an answer to my question. I'm talking about this part:

<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": {{ product.title | json }},
"url": {{ shop.url | append: product.url | json }},
{%- if product.featured_media -%}
{%- assign media_size = product.featured_media.preview_image.width | append: 'x' -%}
"image": [
{{ product.featured_media | img_url: media_size | prepend: "https:" | json }}
],
{%- endif -%}
"description": {{ product.description | strip_html | json }},
{%- if current_variant.sku != blank -%}
"sku": {{ current_variant.sku | json }},
{%- endif -%}
"brand": {
"@type": "Thing",
"name": {{ product.vendor | json }}
},
"offers": [
{%- for variant in product.variants -%}
{
"@type" : "Offer",
{%- if variant.sku != blank -%}
"sku": {{ variant.sku | json }},
{%- endif -%}
"availability" : "http://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}",
"price" : {{ variant.price | divided_by: 100.00 | json }},
"priceCurrency" : {{ cart.currency.iso_code | json }},
"url" : {{ shop.url | append: variant.url | json }}
}{% unless forloop.last %},{% endunless %}
{%- endfor -%}
]
}
</script>

Thank you in advance.

Henry_dev
Shopify Partner
105 19 35

In which file did you write this code?

<script type="application/ld+json">
{
"@context": "http://schema.org/",
"@type": "Product",
"name": {{ product.title | json }},
"url": {{ shop.url | append: product.url | json }},
{%- if product.featured_media -%}
{%- assign media_size = product.featured_media.preview_image.width | append: 'x' -%}
"image": [
{{ product.featured_media | img_url: media_size | prepend: "https:" | json }}
],
{%- endif -%}
"description": {{ product.description | strip_html | json }},
{%- if current_variant.sku != blank -%}
"sku": {{ current_variant.sku | json }},
{%- endif -%}
"brand": {
"@type": "Thing",
"name": {{ product.vendor | json }}
},
"offers": [
{%- for variant in product.variants -%}
{
"@type" : "Offer",
{%- if variant.sku != blank -%}
"sku": {{ variant.sku | json }},
{%- endif -%}
"availability" : "http://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}",
"price" : {{ variant.price | divided_by: 100.00 | json }},
"priceCurrency" : {{ cart.currency.iso_code | json }},
"url" : {{ shop.url | append: variant.url | json }}
}{% unless forloop.last %},{% endunless %}
{%- endfor -%}
]
}
</script>

Have you converted the file in templates/product.liquid =>> templates/product.json?

Gunnar-
New Member
4 0 0

Hi @Henry_dev ,

That code comes from the product.liquid template file from the Debut theme and is nowhere to be found in the Dawn theme (I would expect to find it in the main-product.liquid section).

Thank you.

Henry_dev
Shopify Partner
105 19 35

In the Dawn theme that code is deprecated. However you can create a new section like main-product.liquid and copy all the code in the product.liquid file to the main-product.liquid file

Example: sections/main-product.liquid:

 

<script>
  // Override default values of shop.strings for each template.
  // Alternate product templates can change values of
  // add to cart button, sold out, and unavailable states here.
  theme.productStrings = {
    addToCart: {{ 'products.product.add_to_cart' | t | json }},
    soldOut: {{ 'products.product.sold_out' | t | json }},
    unavailable: {{ 'products.product.unavailable' | t | json }}
  };

  if(sessionStorage.backToCollection) {
    theme.backToCollection = {};
    theme.backToCollection.collection = JSON.parse(sessionStorage.backToCollection);
    var productCollections = {{ product.collections | json }};
    var showCollection = false;
    if (productCollections) {
      productCollections.forEach(function(collection) {
        if (collection.title === theme.backToCollection.collection.title) {
          showCollection = true;
        }
      });
    }
    if(showCollection) {
      var backToCollectionHTML = '<div class="text-center return-link-wrapper page-width"><a href="' + theme.backToCollection.collection.link + '" class="btn btn--secondary btn--has-icon-before">{% include 'icon-arrow-left' %}{{ 'products.product.back_to_collection' | t }} ' + theme.backToCollection.collection.title + '</a></div>';
      var backToCollectionContainer = document.getElementById('backToCollection');
      backToCollectionContainer.insertAdjacentHTML('afterbegin', backToCollectionHTML);
    }
  }
</script>

{% assign current_variant = product.selected_or_first_available_variant %}

<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@type": "Product",
  "name": {{ product.title | json }},
  "url": {{ shop.url | append: product.url | json }},
  {%- if product.featured_media -%}
    {%- assign media_size = product.featured_media.preview_image.width | append: 'x' -%}
    "image": [
      {{ product.featured_media | img_url: media_size | prepend: "https:" | json }}
    ],
  {%- endif -%}
  "description": {{ product.description | strip_html | json }},
  {%- if current_variant.sku != blank -%}
    "sku": {{ current_variant.sku | json }},
  {%- endif -%}
  "brand": {
    "@type": "Thing",
    "name": {{ product.vendor | json }}
  },
  "offers": [
    {%- for variant in product.variants -%}
      {
        "@type" : "Offer",
        {%- if variant.sku != blank -%}
          "sku": {{ variant.sku | json }},
        {%- endif -%}
        "availability" : "http://schema.org/{% if variant.available %}InStock{% else %}OutOfStock{% endif %}",
        "price" : {{ variant.price | divided_by: 100.00 | json }},
        "priceCurrency" : {{ cart.currency.iso_code | json }},
        "url" : {{ shop.url | append: variant.url | json }}
      }{% unless forloop.last %},{% endunless %}
    {%- endfor -%}
  ]
}
</script>

 

Going back to product.liquid you modify it to look like this:

{
  "name": "Product",
  "sections": {
    "main": {
      "type": "main-product"
    }
  },
  "order": [
    "main"
  ]
}
Gunnar-
New Member
4 0 0

Hi @Henry_dev ,

So, it's the depreciated part I'm actually interested in, why is this not needed anymore? How is Google getting their rich results now?

Thanks for the fast help by the way.

drakedev
Shopify Partner
685 148 229

This is an accepted solution.

Hi @Gunnar- 

structured data is not deprecated and still very important for Google and other search engines, Facebook, etc.

Dawn has been built from scratch and at the moment they are focused on the essential features. Could be that they will decide to add that part in future.

If my answer was helpful click Like to say thanks
If the problem is solved remember to click Accept Solution
Shopify/Shopify Plus custom development: You can hire me for simple and/or complex tasks.

ilanadavis
Shopify Expert
181 24 56

Dawn does not have structured data for products at this time. I was only able to find limited data for articles which means you're also missing structured data for your organization, pages, products etc. 

Anyone using Dawn at this point will need to either code the structured data themselves or use an app such as JSON-LD for SEO. The risk of doing it yourself is that it needs to be maintained and updates to your theme can override your code changes.

Ilana Davis, Shopify Superhero
JSON-LD for SEO, adds structured data to your theme, getting you more organic traffic with Rich Results.
Linking Llama, link complementary, comparable, or related products to improve SEO & UX.
ilanadavis
Shopify Expert
181 24 56

Just wanted to follow up on this. The Dawn theme that is currently in the Shopify Theme store now has basic Product structured data.

Ilana Davis, Shopify Superhero
JSON-LD for SEO, adds structured data to your theme, getting you more organic traffic with Rich Results.
Linking Llama, link complementary, comparable, or related products to improve SEO & UX.
Edunation_sa
Tourist
4 0 2

is there a way to add SKU info to the products in Dawn 2.0?

luisonair
Visitor
1 0 0

Where is that basic Product structured data? Can I make changes to the Brand type of a product?