Reputation: 75
My example current url like this in browser:
https://world.blogspot.com/p/any-page.html?country=France&city=Paris
canonical tag like this in page source by browser:
<link href="https://world.blogspot.com/p/any-page.html" rel='canonical' />
I want to change from "any-page.html" to "any-page.html?country=France&city=Paris" in canonical tag for SEO.
There is not available query strings or other details in current canonical tag. I tried many many methods. Everything is unsuccessful.
Anybody have any advice for this ?
I tried this method Change from "any-page.html" to "any-page.html?country=France&city=Paris"
if(!document.getElementById('id2')) {
var link = document.createElement('link');
link.id = 'id2';
link.rel = 'canonical';
link.href = 'https://world.blogspot.com/p/any-page.html?country=France&city=Paris';
document.head.appendChild(link);
}
And similar methods didn't work too
Upvotes: 0
Views: 831
Reputation: 792
Actually till now there is no blogger tags rendering full page location with parameters.
You can render a single parameter using ?view=foo
, you might separate parameter and value using a dash -
like that: ?view=country-France
.
Edit:
You can override existed <link rel='canonical'>
tag href using Javascript with location.href
to get full page link with parameters:
var CanonicalTag = document.querySelector('link[rel="canonical"]');
CanonicalTag.href = location.href;
Upvotes: 2