function _xmlsitemap_node_links in XML sitemap 5
Get node links.
Parameters
$excludes: An array of node types to exclude.:
Return value
An array of links. Each link is an array containing the XML values for a site map URL.
Related topics
1 call to _xmlsitemap_node_links()
- xmlsitemap_node_xmlsitemap_links in xmlsitemap_node/
xmlsitemap_node.module - Implementation of hook_xmlsitemap_links().
File
- xmlsitemap_node/
xmlsitemap_node.module, line 55 - Adds nodes to the site map.
Code
function _xmlsitemap_node_links($excludes = array()) {
$links = array();
if (module_exists('comment')) {
$sql = "\n SELECT n.nid, n.type, n.promote, s.comment_count, n.changed, xn.previously_changed, s.last_comment_timestamp, xn.previous_comment, xn.priority_override, ua.dst AS alias\n FROM {node} n\n LEFT JOIN {node_comment_statistics} s ON s.nid = n.nid";
}
else {
$sql = "\n SELECT n.nid, n.type, n.promote, n.changed, xn.previously_changed, xn.priority_override, ua.dst AS alias\n FROM {node} n";
}
$sql .= "\n LEFT JOIN {xmlsitemap_node} xn ON xn.nid = n.nid\n LEFT JOIN {url_alias} ua ON ua.pid = xn.pid\n WHERE n.status > 0\n AND (n.type NOT IN ('" . implode("', '", $excludes) . "') AND xn.priority_override IS NULL OR xn.priority_override >= 0)\n AND n.nid <> %d";
$result = db_query(db_rewrite_sql($sql), _xmlsitemap_node_frontpage());
while ($node = db_fetch_object($result)) {
$links[] = array(
'nid' => $node->nid,
'#loc' => xmlsitemap_url('node/' . $node->nid, $node->alias, NULL, NULL, TRUE),
'#lastmod' => variable_get('xmlsitemap_node_count_comments', TRUE) ? max($node->changed, $node->last_comment_timestamp) : $node->changed,
'#changefreq' => xmlsitemap_node_frequency($node),
'#priority' => xmlsitemap_node_priority($node),
);
}
return $links;
}