0

debug($sitemaps->listSitemaps(" http://example.com ", ['contents'=> 'indexed']));

返回

object(Google_Service_Webmasters_SitemapsListResponse) {
    [protected] collection_key => 'sitemap'
    [protected] internal_gapi_mappings => array()
    [protected] sitemapType => 'Google_Service_Webmasters_WmxSitemap'
    [protected] sitemapDataType => 'array'
    [protected] modelData => array(
        'sitemap' => array(
            (int) 0 => array(
                'path' => 'http://example.com/sitemap.xml',
                'lastSubmitted' => '2017-12-31T17:06:56.592Z',
                'isPending' => false,
                'isSitemapsIndex' => false,
                'type' => 'sitemap',
                'lastDownloaded' => '2018-01-03T11:42:39.262Z',
                'warnings' => '0',
                'errors' => '0',
                'contents' => array(
                    (int) 0 => array(
                        'type' => 'web',
                        'submitted' => '4',
                        'indexed' => '0'
                    )
                )
            )
        )
    )
    [protected] processed => array()
}

modeldata 应返回包含日期和索引值的数据数组

4

1 回答 1

0

我担心它还不是 Search Console API 的一部分。Google 产品论坛上也有此帖子:https ://productforums.google.com/forum/?hl=en#!topic/webmasters/KIUsaXpquKY;context-place= topicsearchin/webmasters/category $3Awebmaster-tools%7Csort :relevance%7Cspell:false

从那以后我没有看到任何变化,所以如果我是你,我不会屏住呼吸。

您可以从 API 中获得的最接近某个数字(表示被 Google 索引的页面数量)是对您提交的所有站点地图和/或站点地图索引的所有 contents[].indexed 求和。可能您只提交了一个引用所有站点地图的站点地图索引,因此如果您使用 Sitemaps:get 请求该索引(https://developers.google.com/webmaster-tools/search-console-api-original/v3/sitemaps/get ) 你得到索引的页面总数。

但这个数字与实际索引状态的相关性很差,您可以在 Search Console UI 中以我无法正确理解的方式找到它。

我认为,如果您有一个包含网站每个页面的 sitemap.xml,contents[].indexed 的总和将与索引页面的总数非常接近。情况似乎并非如此。

于 2018-08-08T03:45:41.230 回答