X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing and adding new features (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   JSON-LD <script type="application/ld+json"> Question (https://forum.x-cart.com/showthread.php?t=76746)

elmirage001 01-07-2019 02:50 PM

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

elmirage001 01-07-2019 03:25 PM

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>


cflsystems 01-07-2019 05:41 PM

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

elmirage001 01-08-2019 01:32 PM

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

cflsystems 01-08-2019 01:38 PM

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

elmirage001 01-08-2019 01:57 PM

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... :-)

PhilJ 01-08-2019 01:59 PM

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.

elmirage001 01-08-2019 02:20 PM

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

elmirage001 01-08-2019 02:29 PM

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

cflsystems 01-08-2019 03:34 PM

Re: JSON-LD <script type="application/ld+json"> Question
 
You are welcome. Good to hear you got it resolved


All times are GMT -8. The time now is 12:15 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.