Meta description generator from URL using JavaScript In this example we will extract current url and then change the symboles of url ("-", "_", "/"...), then we will put these words as the meta description content in the head <script> var pathname= window.location.pathname; var pathname1=pathname.split("-").join(", ").split("/").join(", ").split(".html").join(" "); document.head.innerHTML+='<meta content="this keyword generate from URL => '+pathname1+'" name="description">' // setTimeout (function(){ var meta_des=document.querySelector('meta[name="description"]').content; console.log(meta_des) document.body.innerHTML=meta_des; },3000) </script> © Manajmnt code Share to : ☷✎ Comments
Comments
Post a Comment
message