我的示例当前URL在浏览器中是这样的:
https://world.blogspot.com/p/any-page.html?country=France&city=Paris
通过浏览器在页面源中使用这样的规范标记:
<link href="https://world.blogspot.com/p/any-page.html" rel='canonical' />
当前的规范标签中没有可用的查询字符串或其他详细信息。我尝试了很多方法。一切都不成功。
有人对此有何建议?
我尝试过这种方法从“ any-page.html”更改为“ 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);
}
而且类似的方法也不起作用
实际上到目前为止,没有博客标签呈现带有参数的完整页面位置。
您可以使用?view=foo
渲染单个参数,也可以使用破折号-
将参数和值分开,例如:?view=country-France
。