JSON error when adding data markup to header code

JSON error when adding data markup to header code

BLKlabel11
Visitor
2 0 0

Hi,

 

I am trying to add structured data markup to my product pages, as per the instructions on this blog https://www.semrush.com/blog/rich-snippets/ however when I do I get an error in the shopify product edit code page that says thee is an error with the code.  However I copied this code exact from the google output and it matches the structure in the instructions in the blog.  Please help.

 

Thanks, Image 2-7-2024 at 8.46 AM.jpeg

Replies 5 (5)

ilanadavis
Shopify Partner
209 27 71

Your code should go into a .liquid file, not .json file.

JSON is not the same thing as JSON-LD. JSON is a file format to transmit data. JSON-LD is a method to link data using JSON.

 

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.

ProtoMan44
Shopify Partner
495 43 80

@BLKlabel11 hey, thanks for posting here.

Don't use JSON file to add rich schema, please put these codes under the main product section (liquid file).

I hope it will work.

- A thirsty developer passionate about supporting the community. If you'd like to, you can  

Buy me a Coffee.


- Your Shopify Solution Specialist Get a Quote at

ProtoMan44

 - 

Chat On Whatsapp


Crafting exceptional e-commerce experiences to elevate your online presence. Let's build your success story together!

ProtoMan44
Shopify Partner
495 43 80

@BLKlabel11 like this :

ProtoMan44_0-1719892892703.png

 

- A thirsty developer passionate about supporting the community. If you'd like to, you can  

Buy me a Coffee.


- Your Shopify Solution Specialist Get a Quote at

ProtoMan44

 - 

Chat On Whatsapp


Crafting exceptional e-commerce experiences to elevate your online presence. Let's build your success story together!
BLKlabel11
Visitor
2 0 0

Thanks but don't I have to put it against each individual product ?  I can't see liquid for each product 

ProtoMan44
Shopify Partner
495 43 80

@BLKlabel11 if you want to add it for the specific product so add in a condition.

you can search product.liquid or main. product.liquid in section folder
can you please share the name of the theme?

- A thirsty developer passionate about supporting the community. If you'd like to, you can  

Buy me a Coffee.


- Your Shopify Solution Specialist Get a Quote at

ProtoMan44

 - 

Chat On Whatsapp


Crafting exceptional e-commerce experiences to elevate your online presence. Let's build your success story together!