[英]Why isn't my javascript-rendered navbar being crawled?
My bootstrap navbar is loaded through a function call in $(document).ready. 我的引导导航栏是通过$(document).ready中的函数调用加载的。 This function loads the navbar (in header.html) something like this: 该函数加载导航栏(在header.html中),如下所示:
function loadHeader(callback){
$.ajax({
url: "/resources/"+language+"/header.html",
async: true,
success: function (data) {
$('body').append(data);
if(callback){
callback();
}
},
dataType: 'html'
});
}
I've tried setting async=false, but the crawlers will still not pick up the links in the navbar (I've tried with fetch+render through Google search console, as well as through the crawler program Screaming Frog). 我尝试设置async = false,但是搜寻器仍然不会在导航栏中选取链接(我已经尝试通过Google搜索控制台以及搜寻器程序Screaming Frog使用fetch + render进行获取)。
The strangest thing is that the navbar is loaded BEFORE several other dynamic page elements, which Google search console has no problem rendering. 最奇怪的是,导航栏是在其他几个动态页面元素之前加载的,Google搜索控制台的呈现效果没有问题。
Here is a preview of what my navbar (in header.html) looks like: 这是我的导航栏(位于header.html中)的预览:
<nav class="navbar navbar-default navbar-fixed-top index-nav">
<div class="container" style="width:100%;">
<div class="navbrand">
<a class="navbar-brand page-scroll" href="/en/">
<img class="homelogo" src="/logos/company-Logo.png"/>
</a>
</div>
<ul class="nav navbar-nav navbar-left">
<li class="dropdown resourcesLI">
<a class="dropdown-toggle mousePointer" data-toggle="dropdown">Resources</a>
<ul class="dropdown-menu" role="menu">
<li class="Link"><a href="/en/page_1.html">Page 1</a></li>
<li class="Link"><a href="/en/page_2.html">Page 2</a></li>
</ul>
</li>
</ul>
</div>
</nav>
Why aren't my navbar links being picked up by crawlers? 为什么我的导航栏链接没有被搜寻器拾取?
Edit: it should be noted that I'm very new to SEO 编辑:应该注意的是,我对SEO非常陌生
Generally I've answered your question in other way in this post: https://stackoverflow.com/a/38948082/6715875 通常,我在这篇文章中以其他方式回答了您的问题: https : //stackoverflow.com/a/38948082/6715875
But if I wana elaborate more for you, I would say to you in a briefly: All contents which have been updated partially after that DOM
loaded, won't be indexed by the search engine crawlers. 但是,如果我想为您详细说明,我会简短地对您说:在DOM
加载之后部分更新的所有内容都不会被搜索引擎搜寻器索引。 In these case you can pick some soloutions up which I've mentioned in above link. 在这种情况下,您可以选择上面链接中提到的一些解决方案。
Regards. 问候。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.