Re: Unparsable Structured Data

Unparsable Structured Data

AvyCoffee
Excursionist
23 0 7

Hello. I, for the life of me, can't figure this out. Can I please get some direction?

 

AvyCoffee_0-1723736049091.png

AvyCoffee_1-1723736071625.png

AvyCoffee_2-1723737699583.png

 

Replies 4 (4)

PaulNewton
Shopify Partner
7450 657 1562

Hi @AvyCoffee That indicates something is wrong with the built in structured_data filter that was recently added.

assuming the "product" object being used is an actual product object and not some sort of accidental incorrect variable assignment.

 

If you've customized the code of your theme first try a fresh install of the theme to see if the issue persists in an unmodified theme.

If an unmodified theme does not have the same issue there is something wrong with any code changes done to the theme.

 

If your using a shopify supported theme such as Dawn contact shopify support directy to report a bug

https://help.shopify.com/en/support/support-type 

 

 

The interim alternative is to create your own /ld+json schema and replace that liquid filter.

 

For dawn the structured_data filter was added in these pull requests:

https://github.com/Shopify/dawn/pull/3507 

https://github.com/Shopify/dawn/pull/3380 

 

Contact paull.newton+shopifyforum@gmail.com for the solutions you need


Save time & money ,Ask Questions The Smart Way


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Thank Paul with a Coffee for more answers or donate to eff.org


ilanadavis
Shopify Partner
230 29 78

Hey @AvyCoffee 

 

The issue is that you have an if statement inside the script tag which isn't valid and then if it's not found, the text "product not found" wouldn't be valid either. Once you pull the if statement outside of the script tag, your error should go away.

Ilana Davis, Shopify Superhero
JSON-LD for SEO, adds structured data to your theme, getting you more organic traffic with Rich Results.
AvyCoffee
Excursionist
23 0 7

Thank you. Are you saying I should delete the highlighted code? (line 718)

 

AvyCoffee_0-1723751331611.png

 

ilanadavis
Shopify Partner
230 29 78

Your entire if statements need to be outside the script tag. So if you want the if statement it should roughly look like:

 

if product

script open

product structured data

script closed

end if

 

I can't tell if you're on a product file or not. If you are, you shouldn't need the if statement at all.

Ilana Davis, Shopify Superhero
JSON-LD for SEO, adds structured data to your theme, getting you more organic traffic with Rich Results.