1

我使用 php 创建了一个动态站点地图,您可以在此链接中看到我的站点地图

我要将此链接提交给谷歌网站管理员工具,但我不知道这是在 1 页中发布所有站点地图的正确方法,还是可能为此使用分页?我不知道哪种方法是正确的,但这个网站有 500 或 600 个用户一天,我认为将它们全部插入站点地图不是正确的方法..现在需要帮助

这是我创建此站点地图的代码

header("Content-type: text/xml");
$xml = new DomDocument('1.0', 'utf-8'); 
$xml->formatOutput = true; 

// creating base node
$urlset = $xml->createElement('urlset'); 
$urlset -> appendChild(
    new DomAttr('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9')
);

    // appending it to document
$xml -> appendChild($urlset);

// building the xml document with your website content
foreach($content as $entry)
{

    //Creating single url node
    $url = $xml->createElement('url'); 

    //Filling node with entry info
    $url -> appendChild( $xml->createElement('loc', $entry['permalink']) ); 
    $url -> appendChild( $lastmod = $xml->createElement('lastmod', $entry['updated']) ); 
    $url -> appendChild( $changefreq = $xml->createElement('changefreq', 'monthly') ); 

    // append url to urlset node
    $urlset -> appendChild($url);

}

echo $xml->saveXML();
?>
4

1 回答 1

1

创建站点地图 - Google 网站管理员工具

一个站点地图文件可以包含不超过 50,000 个 URL,并且在未压缩时不得大于 50MB。如果您的站点地图大于此值,请将其分成几个较小的站点地图。

如果您有多个站点地图,您可以在站点地图索引文件中列出它们,然后将站点地图索引文件提交给 Google。

于 2013-06-27T16:24:53.367 回答