function theme_xmlsitemap_node_view_sitemap in XML sitemap 5
Same name and namespace in other branches
- 5.2 xmlsitemap_node/xmlsitemap_node.module \theme_xmlsitemap_node_view_sitemap()
Display the nodes of a view as an XML site map.
Related topics
File
- xmlsitemap_node/
xmlsitemap_node.module, line 466 - Adds nodes to the site map.
Code
function theme_xmlsitemap_node_view_sitemap($view, $nodes, $type) {
drupal_set_header('Content-Type: text/xml; charset=utf-8');
$xsl_path = file_directory_path() . '/xmlsitemap/gss.xsl';
$xsl_path = file_exists($xsl_path) ? _xmlsitemap_file_create_url($xsl_path) : $base_path . drupal_get_path('module', 'xmlsitemap') . '/gss/gss.xsl';
$output .= '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$output .= '<?xml-stylesheet type="text/xsl" href="' . $xsl_path . '" ?>' . "\n";
$output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"' . "\n";
$output .= ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' . "\n";
$output .= ' xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9' . "\n";
$output .= ' http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' . "\n";
foreach ($nodes as $node) {
$lastmod = variable_get('xmlsitemap_node_count_comments', TRUE) ? max($node->changed, $node->last_comment_timestamp) : $node->changed;
$output .= ' <url>' . "\n";
$output .= ' <loc>' . xmlsitemap_url('node/' . $node->nid, $node->alias, NULL, NULL, TRUE) . '</loc>' . "\n";
$output .= ' <lastmod>' . gmdate('Y-m-d\\TH:i:s+00:00', $lastmod) . '</lastmod>' . "\n";
$output .= ' <changefreq>' . _xmlsitemap_frequency(xmlsitemap_node_frequency($node)) . '</changefreq>' . "\n";
$output .= ' <priority>' . number_format(xmlsitemap_node_priority($node), 1) . '</priority>' . "\n";
$output .= ' </url>' . "\n";
}
$output .= '</urlset>';
print $output;
module_invoke_all('exit');
exit;
}