Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

JSON-LD <script type="application/ld+json"> Question

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 01-07-2019, 02:50 PM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,966
 

Default JSON-LD <script type="application/ld+json"> Question

One of my static pages is ranking really well and we receive a large amount of traffic from this page. Recently we dropped from #2 to #5 so I'm trying to add JSON-LD structured data to this static page.

My issue is that while the structured data validates fine with the Google Structured Data Testing Tool, the testing tool can not not find it on the page. I moved it from the <body> to the <head> section but it's still not working and then I saw when using View Source that the <script type="application/ld+json"> changed to <script type="text/javascript"> so maybe that's why Google is not seeing it.

Does anyone know how to stop <script type="application/ld+json"> from changing to <script type="text/javascript"> when x-cart publishes a static page?

.tpl code
Code:
{literal} <script type="application/ld+json"> { "@context" : "http://schema.org", "@type" : "Article", .blah .blah .blah } </script> {/literal}
HTML source

Code:
<script type="text/javascript">{"@context":"http://schema.org","@type":"Article","headline": </head>
Thanks! Paul
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
  #2  
Old 01-07-2019, 03:25 PM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,966
 

Default Re: JSON-LD <script type="application/ld+json"> Question

Here is valid Article starter code if anyone wants to use.

Code:
<script type="application/ld+json"> { "@context" : "http://schema.org", "@type" : "Article", "headline": "Your Headline", "name" : "Name", "mainEntityOfPage": "hxxps://www.yoursite.com/article.html", "datePublished": "2016-05-08", "dateModified": "2019-01-06", "image" : "hxxps://www.yoursite.com/article-image.jpg", "publisher": { "@type" : "Organization", "name" : "Your Business", "logo": { "@type": "ImageObject", "name": "xxx-Logo", "width": "480", "height": "60", "url": "hxxps://www.yoursite.com/logo.png" } }, "author" : { "@type" : "Person", "name" : "Author Name" } } </script>
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
  #3  
Old 01-07-2019, 05:41 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,199
 

Default Re: JSON-LD <script type="application/ld+json"> Question

Nothing in XC will replace type for script. You have something custom or 3rd party module doing this.

BTW you can safely place this script at the very bottom of the page. Google will find it regardless where it is
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
elmirage001 (01-08-2019)
  #4  
Old 01-08-2019, 01:32 PM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,966
 

Default Re: JSON-LD <script type="application/ld+json"> Question

That helps narrow it a lot. Thanks Steve!

I can confirm it's the <script type="application/ld+json"> changing to <script type="text/javascript"> that is the problem. I copied the entire view source code from the browser and pasted it into the code area on Google Structured Data Testing Tool. I then changed <script type="text/javascript"> back to <script type="application/ld+json"> and the Google testing tool finds and verifies it. I tested with the structured markup data pasted at the end of the article text while editing the static page.

I'll report back if I can fix why it's changing in the first place.

Paul
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
  #5  
Old 01-08-2019, 01:38 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,199
 

Default Re: JSON-LD <script type="application/ld+json"> Question

If you have cdseo that could be the issue or your theme. You can star by turning off 3rd party mods one by one to see which one is doing it
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
elmirage001 (01-08-2019)
  #6  
Old 01-08-2019, 01:57 PM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,966
 

Default Re: JSON-LD <script type="application/ld+json"> Question

Quote:
Originally Posted by cflsystems
If you have cdseo that could be the issue or your theme. You can star by turning off 3rd party mods one by one to see which one is doing it
Great idea! I'll be back...
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
  #7  
Old 01-08-2019, 01:59 PM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: JSON-LD <script type="application/ld+json"> Question

Might be the Dynamic Website Compressor Paul, try disabling it. I have modified it so that it ignores all JS including JSON-LD, get in touch if you want it.
__________________
xcartmods.co.uk
Reply With Quote

The following user thanks PhilJ for this useful post:
elmirage001 (01-08-2019)
  #8  
Old 01-08-2019, 02:20 PM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,966
 

Default Re: JSON-LD <script type="application/ld+json"> Question

Quote:
Originally Posted by PhilJ
Might be the Dynamic Website Compressor Paul, try disabling it. I have modified it so that it ignores all JS including JSON-LD, get in touch if you want it.

Hi Phil!

BINGO! That solved it!

Thank you so much!

Paul
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
  #9  
Old 01-08-2019, 02:29 PM
 
elmirage001 elmirage001 is offline
 

X-Wizard
  
Join Date: Apr 2007
Posts: 1,966
 

Default Re: JSON-LD <script type="application/ld+json"> Question

Quote:
Originally Posted by cflsystems
If you have cdseo that could be the issue or your theme. You can star by turning off 3rd party mods one by one to see which one is doing it
Thanks Steve for all your help. It's very much appreciated! Paul
__________________
X-Cart GoldPlus v4.7.12 | reBOOT (reDUX) Template v4.7.12.9 | Always The Best
Reply With Quote
  #10  
Old 01-08-2019, 03:34 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,199
 

Default Re: JSON-LD <script type="application/ld+json"> Question

You are welcome. Good to hear you got it resolved
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:27 PM.

   

 
X-Cart forums © 2001-2020