Linked AMP version is invalid

Posted in: Newspaper
Post count: 15

My website- https://techigtv.net
I also checked your previous article but not able to fix this issue, because maybe my issue is different I am not using a W3 cache plugin.
and please let me know how to fix this error “Custom Javascript is not allowed.”
Two ERRORS are showing after a click on the Custom Javascript I am pasting these 2 errors

1. <script type=”text/javascript”>

2. <script type=”text/javascript”>(function(XHR){var open=XHR.prototype.open;var send=XHR.prototype.send;var parser=document.createElement(‘a’);XHR.prototype.open=function(method, url, async, user, pass){if(typeof async==’undefined’){async=true;}parser.href=url;if(parser.host==”){parser.href=parser.href;}this.ajax_hostname=parser.hostname;open.call(this, method, url, async, user, pass);};XHR.prototype.send=function(data){if(location.hostname==this.ajax_hostname)this.setRequestHeader(“X-MOD-SBB-CTYPE”, “xhr”);send.call(this, data);}})(XMLHttpRequest);if(typeof(fetch)!=”undefined”){var nsbbfetch=fetch;fetch=function(url, init){if(typeof(url)===”object” && typeof(url.url)===”string”){url=url.url;}function sbbSd(url, domain){var parser=document.createElement(‘a’);parser.href=url;if(parser.host==”){parser.href=parser.href;}return parser.hostname==location.hostname;}if(sbbSd(url, document.domain)){init=typeof init !==’undefined’ ? init :{};if(typeof(init.headers)===”undefined”){init.headers={};}init.headers[‘X-MOD-SBB-CTYPE’]=’fetch’;}return nsbbfetch(url, init);};}function sbbgc(check_name){var start=document.cookie.indexOf(check_name+”=”);var oVal=”;var len=start+check_name.length+1;if((!start)&&(document.cookie.substring(0,check_name.length)!=check_name)){oVal=”;}else if(start==-1){oVal=”;}else{var end=document.cookie.indexOf(‘;’,len);if(end==-1)end=document.cookie.length;var oVal=document.cookie.substring(len,end);};return oVal;}function addmg(inm,ext){var primgobj=document.createElement(‘IMG’);primgobj.src=window.location.protocol+”//”+window.location.hostname+(window.location.port && window.location.port!=80 ? ‘:’+window.location.port: ”)+”/sbbi/?sbbpg=”+inm+(ext?”&”+ext:””);var sbbDiv=document.getElementById(‘sbbfrcc’);sbbDiv.appendChild(primgobj);};function addprid(prid){var oldVal=sbbgc(“PRLST”);if((oldVal.indexOf(prid)==-1)&&(oldVal.split(‘/’).length<5)){if(oldVal!=”){oldVal+=’/’;}document.cookie=’PRLST=’+oldVal+escape(prid)+’;path=/;’;}}var sbbeccf=function(){this.sp3=”jass”;this.sf1=function(vd){return sf2(vd)+32;};var sf2=function(avd){return avd*12;};this.sf4=function(yavd){return yavd+2;};var strrp=function(str, key, value){if(str.indexOf(‘&’+key+’=’)> -1 || str.indexOf(key+’=’)==0){var idx=str.indexOf(‘&’+key+’=’);if(idx==-1)idx=str.indexOf(key+’=’);var end=str.indexOf(‘&’, idx+1);var newstr;if(end !=-1)newstr=str.substr(0, idx)+str.substr(end+(idx ? 0 : 1))+’&’+key+’=’+value;else newstr=str.substr(0, idx)+’&’+key+’=’+value;return newstr;}else return str+’&’+key+’=’+value;};var strgt=function(name, text){if(typeof text !=’string’)return “”;var nameEQ=name+”=”;var ca=text.split(/[;&]/);for(var i=0;i < ca.length;i++){var c=ca[i];while(c.charAt(0)==’ ‘)c=c.substring(1, c.length);if(c.indexOf(nameEQ)==0)return c.substring(nameEQ.length, c.length);}return “”;};this.sfecgs={sbbgh:function(){var domain=document.location.host;if(domain.indexOf(‘www.’)==0)domain=domain.replace(‘www.’, ”);return domain;}, f:function(name, value){var fv=””;if(window.globalStorage){var host=this.sbbgh();try{if(typeof(value)!=”undefined”)globalStorage[host][name]=value;else{fv=globalStorage[host][name];if(typeof(fv.toString)!=”undefined”)fv=fv.toString();}}catch(e){}}return fv;}, name:”sbbrf”};this.sfecls={f:function(name, value){var fv=””;try{if(window.localStorage){if(typeof(value)!=”undefined”)localStorage.setItem(name, value);else{fv=localStorage.getItem(name);if(typeof(fv.toString)!=”undefined”)fv=fv.toString();}}}catch(e){}return fv;}, name:”sbbrf”};this.sbbcv=function(invl){try{var invalArr=invl.split(“-“);if(invalArr.length>1){if(invalArr[0]==”A”||invalArr[0]==”D”){invl=invalArr[1];}else invl=””;}if(invl==null||typeof(invl)==”undefined”||invl==”falseImgUT”||invl==”undefined”||invl==”null”||invl!=encodeURI(invl))invl=””;if(typeof(invl).toLowerCase()==”string”)if(invl.length>20)if(invl.substr(0,2)!=”h4″)invl=””;}catch(ex){invl=””;}return invl;};this.sbbsv=function(fv){for(var elm in this){if(this[elm].name==”sbbrf”){this[elm].f(“altutgv2″,fv);}}document.cookie=”UTGv2=”+fv+’;expires=Tue, 31 Dec 2030 00:00:00 UTC;path=/;’;};this.sbbgv=function(){var valArr=Array();var currVal=””;for(var elm in this){if(this[elm].name==”sbbrf”){currVal=this[elm].f(“altutgv2″);currVal=this.sbbcv(currVal);if(currVal!=””)valArr[currVal]=(typeof(valArr[currVal])!=”undefined”?valArr[currVal]+1:1);}}var lb=0;var fv=””;for(var val in valArr){if(valArr[val]>lb){fv=val;lb=valArr[val]}}if(fv==””)fv=sbbgc(“UTGv2″);fv=this.sbbcv(fv);if(fv!=””)this.sbbsv(fv);else this.sbbsv(“D-h44e979449c1a251d9ded2b9c108115aa357″);return fv;};};function m2vr(m1,m2){var i=0;var rc=””;var est=”ghijklmnopqrstuvwyz”;var rnum;var rpl;var charm1=m1.charAt(i);var charm2=m2.charAt(i);while(charm1!=””||charm2!=””){rnum=Math.floor(Math.random()* est.length);rpl=est.substring(rnum,rnum+1);rc+=(charm1==””?rpl:charm1)+(charm2==””?rpl:charm2);i++;charm1=m1.charAt(i);charm2=m2.charAt(i);}return rc;}function sbbls(prid){try{var eut=sbbgc(“UTGv2″);window.sbbeccfi=new sbbeccf();window.sbbgs=sbbeccfi.sbbgv();if(eut!=sbbgs && sbbgs!=”” && typeof(sbbfcr)==”undefined”){addmg(‘utMedia’,”vii=”+m2vr(“4870b6c7ce14b721865ed195dcfa7f2b”,sbbgs));}var sbbiframeObj=document.createElement(‘IFRAME’);var dfx=new Date();sbbiframeObj.id=’SBBCrossIframe’;sbbiframeObj.title=’SBBCrossIframe’;sbbiframeObj.tabindex=’-1′;sbbiframeObj.lang=’en’;sbbiframeObj.style.visibility=’hidden’;sbbiframeObj.setAttribute(‘aria-hidden’, ‘true’);sbbiframeObj.style.border=’0px’;if(document.all){sbbiframeObj.style.position=’absolute’;sbbiframeObj.style.top=’-1px’;sbbiframeObj.style.height=’1px’;sbbiframeObj.style.width=’28px’;}else{sbbiframeObj.style.height=’1px’;sbbiframeObj.style.width=’0px’;}sbbiframeObj.scrolling=”NO”;sbbiframeObj.src=window.location.protocol+”//”+window.location.hostname+(window.location.port && window.location.port!=80 ? ‘:’+window.location.port: ”)+’/sbbi/?sbbpg=sbbShell&gprid=’+prid + ‘&sbbgs=’+sbbgs+’&ddl=’+(Math.round(dfx.getTime()/1000)-1590937931)+”;var sbbDiv=document.getElementById(‘sbbfrcc’);sbbDiv.appendChild(sbbiframeObj);}catch(ex){;}}try{var y=unescape(sbbvscc.replace(/^<\!\-\-\s*|\s*\-\->$/g,”));document.getElementById(‘sbbhscc’).innerHTML=y;var x=unescape(sbbgscc.replace(/^<\!\-\-\s*|\s*\-\->$/g,”));}catch(e){x=’function genPid(){return “jser”;}’;}try{if(window.gprid==undefined)document.write(‘<‘+’script type=”text/javascri’+’pt”>’+x+”var gprid=genPid();addprid(gprid);sbbls(gprid);<“+”/script>”);}catch(e){addprid(“dwer”);}</script>

I really don’t know how to fix this, please help

1. image
2. image

  • This topic was modified 6 years by grvag.
  • This topic was modified 6 years by grvag.
Post count: 15

Hello smart people, please reply I am waiting for your valuable reply

Post count: 35449

Hi,

Please note that we try to answer to as meany topics we can (support hours (GMT+2) are from Monday to Friday: 8:00 AM – 17:00 PM also we had a day off https://i.imgur.com/rpUAb5G.png), we start from the oldest to newest.
Please follow this guide that might be helpful: https://josephkhan.me/custom-javascript-is-not-allowed-amp/

Thank you !

Post count: 15

Thankyou Calin!
But I still have an issue because,
When I reach on my WordPress dashboard and tried to install W3 Total Cache plugin
I am not able to install it because my hosting provider (NameCheap WP-Easy) blocked that plugin because my hosting is using their own cache tool so they are not allowing their user to install any cache related plugin.
You can check the image,
1. image
So what should i do solve the issue
Help

Post count: 35449

Hi,

This message appear because you set a custom JavaScript for ads and this is not allowed in custom JavaScript section, please remove the code from there.
The codes for auto ads need to be set only in analytics -> https://www.screencast.com/t/4yGlHBBQIGgH or in mobile theme > amp analytics -> https://www.screencast.com/t/0WqKEVLN
That looks like an AMP error message
https://www.ampproject.org/docs/troubleshooting/validation_errors#custom-javascript-is-not-allowed
Also please check a similar topic -> https://forum.tagdiv.com/topic/custom-javascript-is-not-allowed/
-> https://forum.tagdiv.com/topic/a-mandatory-amp-html-tag-is-missing-from-this-document/

If your host do not allowed you to use other cache plugin, we can not do anything for this, sorry!
You need to find a solution with your host provide or you can change to another host.

Thank you for your understanding!

Post count: 15

I never inject any such code in my website or even I don’t know to code that’s why I choose you Tagdiv.
I have some questions, please answer
1. As you describe in your latest reply that, I set a custom JavaScript for ads(But I never did so?) if I manage to remove that code than my problem will be solved?
2. It is mandatory that we have to install W3 Total Cache every time if we purchase a newspaper theme in order to fix the amp error?

Thank you
Gaurav Verma

Post count: 35449

Hi,

1. That code can be from some ads or plugins that you are using and yes if this is removed then the problem will be fix.
2. Withe a fresh install there is no need to any extra plugins to make a amp to work, if you want you can make a test on localhost only with theme plugins.
Also we recommend to use WP Super Cache plugin, this is a free plugin and tested with our theme, also we have a guide for the settings you should do -> https://forum.tagdiv.com/cache-plugin-install-and-configure/ W3 Total Cache plugin was in the links that I provide as example, there are users using WP Rocket or Automatize.

This is one of our live demos that has the amp option enable, you can check it if you want -> https://demo.tagdiv.com/newspaper_local_news/

Thank you!

Post count: 15

Thank you for the valuable reply…
I change some things in WordPress they all are listed below
1) Added two extra plugins (Yoast SEO) & (Header Footer Code Manager- “HFCM”)
Uses HFCM to add Google analytic Code.”Please suggest better plugin to add codes in header” which don’t affect the theme and work properly.

2) Edit some file in the root directory “wp-include” >> “functions.php” >> “edit” to hide some WordPress detail (suggested by my hosting provider to increase the security of my website, so I did it)
3) Add a simple class in Appearance >> Customize >>Additional CSS i.e
p {
font-size:18px
}
.tagdiv-type {
font-size:18px
}

Thank you
Now I am thinking of resetting my website and installed it again freshly and published article again.
I am thinking It’s my fault maybe I did something wrong…No problem I will correct it from a start
I feel lucky if you give me some tip?

Post count: 35449

Hi,

You can set the code in header using our theme, with out extra plugins, the code can be set in Theme panel> Analytics/JS Codes -> https://i.imgur.com/U6TJZbV.png

As a suggestion, you can make a test on subdomain or local host with a fresh install only with theme plugins, in this way you can test if the amp is working or if there is still a problem.

Let me know the results!
Thank you!

Post count: 15

Thankyou now its work perfectly fine…
write now I am only using Yoast SEO plugin
now search console doesn’t show any error??

Post count: 35449

Hi, I’m glad that the problem has been resolved!
If you gave other questions, let us know!
Thank you!

Post count: 15

Hello Calin
Now I want to share something with you, I hope you better understand me.
Let’s get to the point:
When we search on google “techigtv” we see the amp link as you see in picture 1.

when I click on the first link, I know its open amp page but when we go into the menu you can also see in picture 2 the menu with subheading like apple > iPhone > MacBook
don’t show drop-down class it automatically shows all the menus because amp pages are reducing CSS.

But when I clicked on any page from the menu my website is no longer stay at amp you can check the picture 3 menu class are back…
Why this is happening why amp link changes to non-amp pages when I click on any page from the menu?

Note*:- When we click on amp page from google search and if we did not click on any page from the menu and if we click any post from the home page my website stays amp.

And
Google Search console only detect my one valid amp page.
Check the image

Thank you
Gaurav Verma
techigtv

Post count: 35449

Hi grvag,

The extended menu will appear only on amp version, on mobile version will appear the menu with arrows, in this way was design the amp version using the mobile theme.
Also The only amp link that I can find is this one -> https://i.imgur.com/qV21M4H.png you need to check if the rest of website is index on Google.

Thank you!

Post count: 15

yes that’s the problem indexing of my website is really slow out of 17 posts 11 are indexed and other 6 are “discovered but not index” and

only one amp page is indexed.
I have to clear that, I have only one front page that I got with the theme only this page is indexed as an amp and other like categories, tags and post are not indexing as an amp.

Only one amp link is showing in the google search console

Guide me what I am doing wrong

Note*- when I checked the TEST LIVE URL on search console it says Linked AMP version is valid
but after one month of work, I only got one amp link

Is I am doing something wrong and I felt like indexing of my website is slow.

Post count: 35449

Hi,

Please check what elements have you set to be convert in amp -> https://i.imgur.com/U4oYRJu.png check all of these that you want to have an amp version.
Also make sure that your posts/pages are visible by google an are indexed.
Enhance AMP content for Google Search

Thank you!

Post count: 15

you can check the image, I have selected these elements to be converted in AMP
picture

I use this link to check if my link is valid for amp or not https://search.google.com/test/amp check the image its shows valid but google is not indexing it picture 2

Google search console also shows amp linked is valid picture 3

so why they are not indexing my amp post in search console they are showing only one link that is techigtv.net/?amp

but others are valid too.

  • This reply was modified 6 years by grvag.
Post count: 18283

Hello !

Unfortunately this doesn’t fall under Newspaper Theme support. You can contact google amp and let them know about your issue. Unfortunately this is not Newspaper Theme related from what our developers can find.

Thank you for your understanding !

Post count: 15

ya, I know. But still, I am asking if you suggest something it will be grateful.
Thankyou

Post count: 35449

Hi grvag,

This link https://search.google.com/test/amp is only for testing if your amp version is a valid one, it’s has nothing to do with what google index or when it dose. what you can do is to ask google to re-index one of you page/post this can take more then 15 minutes but will be faster to check if google is indexing your amp version or only mobile or desktop.

Thank you for your understanding!

Post count: 6

Hi Calin,
Can you please tell me why our support request has been overlooked?
The Latz Report

Post count: 35449

Hi TheLatzReport,

Please note that we do not overlooked any support request.
Please note that we can provide support only in our support hours and these are from Monday – Friday:8:00 AM – 17:00 PM (GMT+2). Please note that we try to answer to as many topics we can we start from the oldest to newest, once that is set a new reply in a topic this will be move the new topics, therefore it can take some time until we get back to your topic.

Thank you for your understanding!

Post count: 15

Thankyou Calin for your valuable reply??

Viewing 22 posts - 1 through 22 (of 22 total)
The forum ‘Newspaper’ is closed to new topics and replies.