Skip to content

Instantly share code, notes, and snippets.

@platonische
Created August 28, 2023 08:22
Show Gist options
  • Select an option

  • Save platonische/ca401ac42dfea06b191cef1acd7a8086 to your computer and use it in GitHub Desktop.

Select an option

Save platonische/ca401ac42dfea06b191cef1acd7a8086 to your computer and use it in GitHub Desktop.
Browsers js / Show SEO matter goods
javascript:void((
function() {
const images = document.querySelectorAll('img');
const missingAlt = [...images].filter(img => !img.hasAttribute('alt') || img.alt === '');
missingAlt.forEach(img => {
img.style.border = '2px solid red';
console.log(img); });
alert("Found wrong alts: "+missingAlt.length);
}
)())
javascript:void((
function() {
var a,b,c,d,e,f,j,h,i,g,k,h1=0;i=document.getElementsByTagName("title");g = '---> title = '+i[0].innerHTML.length+'\n'+i[0].innerHTML+'\n'; f=new Array("pink","orange","yellow","aquamarine","lightskyblue","plum");for(a=1;a<=6;a++) { b=document.getElementsByTagName("h"+a);for(c=0;c<b.length;c++) { d=b[c]; if (a==1){ h1++; g+='---> h1 = '+d.innerHTML.length+'\n'+d.innerHTML+'\n'; }e=d.style; e.backgroundColor=f[a-1]; e.border="1px solid black";e.color="black"; d.innerHTML="H"+a+" "+d.innerHTML;}}j=document.getElementsByTagName("meta");for (h=0;h<j.length;h++) { if (j[h].name=='description') {g += '---> desc = '+j[h].content.length+'\n'+j[h].content+'\n';} if (j[h].name=='robots') {g += '--> ROBOTS <-- = '+j[h].content+'\n';if (j[h].content.includes('noindex')){g+='--> NOINDEX NOINDEX NOINDEX\n\n';}} } k=document.getElementsByTagName("link");for (h=0;h<k.length;h++) {if (k[h].rel=='canonical') {g += '--> Canonical <-- = '+k[h].href+'\n';} }if (h1>1) {g+='---%D0%9E%D1%88%D0%B8%D0%B1%D0%BA%D0%B0---\nH1 - '+h1+' %D1%88%D1%82.\n';} alert(g);
})())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment