OK. I know this adds 1200px no matter what. That was the purpose of it. I was trying to see if there is a workaround to disable this for two pages. I guess not. Thanks for your time. I think I will just delete this and go back to each and every page to add it in manually.
Check out my page again. I have made it a mobile page, without adding viewport. I can have it set so when a users current width is greater than the page width, then go to full version.
Still kind of irrelevant but thank you for your time.
Does any of this apply to removing the meta tags for seo? Iâd like to remove them and add my own so I can have more options
Actually, I think I found a workaround.
With Javascript, you can detect the page youâre on.
Instead of removing the meta, just modify based on page. To do this, you can (instead of adding a </meta/> tag at the header) add a script to add the meta. In the script, you would add something like this:
Wrap this in a </script/> tag in your header (no slashes).
let meta = document.createElement('meta');
if(document.URL.indexOf("whatever your url is to make mobile") != -1) {
meta.name = "viewport";
meta.content = "width=320";
document.getElementsByTagName('head')[0].appendChild(meta);
} else {
meta.name = "viewport";
meta.content = "width=1200";
document.getElementsByTagName('head')[0].appendChild(meta);
}
Also, the âwhatever your url is to make mobileâ can be a slug/parameter as well.
Hope this works for you guys!
@chad Do you mean adding new ones based on the type of page? The current ones donât effect SEO to my knowledge.
This is what i was looking for. Why didnât I think of putting an âifâ statement⌠lol. Great Work. Thank you very much.
I was able to put the url as just the page name and it is working. I will have to make sure it works in Live also, but i donât see why it wouldnât. Also i should be able to add âelse ifâ statement in between right. Thanks again.
Correct. Absolutely.
This topic was automatically closed after 70 days. New replies are no longer allowed.