【问题标题】:How do you notify Google through code that there is a updated sitemap?您如何通过代码通知 Google 有更新的站点地图?
【发布时间】:2010-10-07 00:48:07
【问题描述】:

在此 Google 帮助页面上:

https://www.google.com/webmasters/tools/docs/en/sitemap-generator.html#submitting

Google 提到有一种方法可以使用 HTTP 请求通知他们更新的站点地图。

当你点击链接时,它会带你到这个页面:

http://www.google.com/support/webmasters/bin/answer.py?answer=34592&topic=8482&hl=en#ping

但是没有关于在哪里 ping 什么请求的信息。

有谁知道这个地址是什么,需要什么参数?

【问题讨论】:

    标签: sitemap google-search-console


    【解决方案1】:

    http://www.google.com/webmasters/sitemaps/ping?sitemap=您的站点地图的 URL 编码 URL

    【讨论】:

      【解决方案2】:

      最简单的解决方案:file_get_contents("https://www.google.com/webmasters/tools/ping?sitemap={$sitemap}");

      这适用于每个主要的托管服务提供商。如果您想要可选的错误报告,请从这里开始:

      $data = file_get_contents("https://www.google.com/webmasters/tools/ping?sitemap={$sitemap}");
      $status = ( strpos($data,"Sitemap Notification Received") !== false ) ? "OK" : "ERROR";
      echo "Submitting Google Sitemap: {$status}\n";
      

      至于您应该多久执行一次,只要您的网站可以处理来自 Google 机器人的额外流量而不会减慢速度,您就应该在每次进行更改时执行此操作。

      【讨论】:

        【解决方案3】:

        Google 有完整的程序来通知他们更新站点更新,包括如何使用 http 请求(谷歌官方方法)和使用他们的提要进行 ping。在这里阅读官方文档 https://webmasters.googleblog.com/2014/10/best-practices-for-xml-sitemaps-rssatom.html

        希望有所帮助:-)

        【讨论】:

          【解决方案4】:
          猜你喜欢
          • 1970-01-01
          • 2020-02-06
          • 2011-09-22
          • 2011-06-07
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多