【问题标题】:Unable to crawl my new site using Google Search Console无法使用 Google Search Console 抓取我的新网站
【发布时间】:2018-07-09 01:38:07
【问题描述】:

我正在开发一个站点,其后端为 django,前端为 jquery

当调用列表/详细页面 url 时,我将在页面加载时调用 ajax 方法并从后端呈现数据。在backed结果中被django序列化为json数据并渲染回ajax。

例如:

function listFunction(){
  $.ajax({
    url: '<listing-url>',
    type: 'GET',
    dataType: 'json',
  })
  .done(function(response){
      // response as json
      $.each(response, function(index, value){
        $(container).append(value)
      });
  });
}
$(document).ready(function(e){
  listFunction();
});

为了检查我的网站是如何被 google 看到的,我在 google search console 中测试了我的列表页面:

https://www.google.com/webmasters/verification/home?hl=en

我在 Fetch as Google 标签中使用了 Fetch and Render 选项。结果中只加载了页眉、页脚等静态内容,没有通过ajax加载的动态内容显示在结果中。我已经为该站点创建了 站点地图robots.txt

Seo 对我们的项目非常重要。如何在使用 Fetch as Google 时显示我的动态内容?

如果我在编码部分遗漏了什么,请告诉我。

谢谢。

【问题讨论】:

  • 刚才我也用tools.pingdom.com分析了应用。这里的动态内容也没有显示在 html 快照中。

标签: jquery django-rest-framework seo web-crawler bots


【解决方案1】:

来自documentation,这表明您的页面代码存在问题,因为 Fetch 和 Render 确实会执行脚本。

Google Search Console 能够抓取网站,因为显示的是静态内容。您的问题与 robots.txt 或站点地图无关。

【讨论】:

  • 您好 JVerstry,问题出在我使用的 JS 语法上。我正在使用最新的语法,例如反引号(`)。但是IE浏览器无法识别。我改变了旧的 JS 语法(使用 babeljs),并且网站在 IE 和 Google Search Console 中正确呈现。 Google 搜索控制台也使用与 IE 相同的机制 br
猜你喜欢
  • 1970-01-01
  • 2023-04-09
  • 2019-12-02
  • 1970-01-01
  • 2017-04-05
  • 1970-01-01
  • 2021-11-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多