Commit f67c8d8b authored by Dave Reid's avatar Dave Reid

#704950 by Dave Reid: Changed chunk URLs from sitemap-x.xml to sitemap.xml?page=x.

parent a7b27998
......@@ -145,9 +145,6 @@ function _xmlsitemap_regenerate_after() {
// Unset the regenerate flag.
variable_set('xmlsitemap_regenerate_needed', FALSE);
// If the chunk count has changed, we will need to rebuild the menu.
variable_set('menu_rebuild_needed', TRUE);
variable_set('xmlsitemap_generated_last', REQUEST_TIME);
}
......@@ -340,7 +337,8 @@ function xmlsitemap_generate_index($handle, &$status, $language) {
for ($i = 1; $i <= $chunk_count; $i++) {
$output = '<sitemap>';
$output .= '<loc>' . url('sitemap-' . $i . '.xml', $url_options) . '</loc>';
$url_options['query']['page'] = $i;
$output .= '<loc>' . url('sitemap.xml', $url_options) . '</loc>';
// @todo Use the actual lastmod value of the chunk file.
$output .= '<lastmod>' . gmdate($lastmod_format, REQUEST_TIME) . '</lastmod>';
$output .= '</sitemap>' . PHP_EOL;
......
......@@ -113,18 +113,6 @@ function xmlsitemap_menu() {
'type' => MENU_CALLBACK,
'file' => 'xmlsitemap.pages.inc',
);
$chunks = xmlsitemap_get_chunk_count();
if ($chunks > 1) {
for ($i = 1; $i <= $chunks; $i++) {
$items['sitemap-' . $i . '.xml'] = array(
'page callback' => 'xmlsitemap_output_chunk',
'page arguments' => array((string) $i),
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
'file' => 'xmlsitemap.pages.inc',
);
}
}
$items['sitemap.xsl'] = array(
'page callback' => 'xmlsitemap_output_xsl',
'access callback' => TRUE,
......
......@@ -13,9 +13,10 @@
*
* @see xmlsitemap_file_transfer()
*/
function xmlsitemap_output_chunk($chunk = 0) {
function xmlsitemap_output_chunk() {
global $language;
$chunk = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 0;
$file = xmlsitemap_get_chunk_file($chunk, $language->language);
xmlsitemap_output_file($file);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment