【发布时间】:2019-08-20 12:14:27
【问题描述】:
我正在生成多个站点地图文件并将站点地图索引与 Opencart 框架一起使用。
$type 是产品、类别、信息
$page 是数字
$output .= ' <sitemap>';
$output .= ' <loc>' .$this->url->link('feed/google_sitemap/'.$type, ($page ? 'page='.$page++ : '')).'</loc>';
$output .= ' <lastmod>'. date('Y-m-d') .'</lastmod>';
$output .= ' </sitemap>';
最后我得到了这样的结果(一切正常)
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://localhost/index.php?route=feed/google_sitemap/product&page=1</loc>
<lastmod>2019-08-20</lastmod>
</sitemap>
<sitemap>
<loc>http://localhost/index.php?route=feed/google_sitemap/product&page=2</loc>
<lastmod>2019-08-20</lastmod>
</sitemap>
</sitemapindex>
链接看起来像这样重要吗?
<loc>http://localhost/index.php?route=feed/google_sitemap/product&page=2</loc>
或者它们应该看起来像
<loc>http://localhost/sitemap-product-1</loc>
【问题讨论】: