Posted by holdmann on December 2, 2012 at 8:25pm
4 followers
| Project: | XML sitemap |
| Version: | 7.x-2.0-rc1 |
| Component: | xmlsitemap_node.module |
| Category: | task |
| Priority: | normal |
| Assigned: | Dave Reid |
| Status: | postponed (maintainer needs more info) |
Issue Summary
I try to attach lastmod field to taxonomy term using following rule:
Get max timestamp from list of all nodes referenced to current term.
<?php
/**
* Implements hook_xmlsitemap_link_alter().
*/
function [my_super_module]_xmlsitemap_link_alter(&$link) {
if ($link['type'] == 'taxonomy_term') {
// search for nodes referenced to current taxonomy term
$nids = db_select('taxonomy_index', 'ti')
->fields('ti', array('nid'))
->condition('ti.tid', $link['id'])
->execute()
->fetchAll(PDO::FETCH_COLUMN, 0);
$timestamps = array();
foreach($nids as $nid) {
$node = node_load($nid); // Here i have to load node. Why?
// Always recalculate changefreq and changecount.
$timestamps = array_merge($timestamps, xmlsitemap_node_get_timestamps($node));
}
$link['lastmod'] = count($timestamps) ? max($timestamps) : 0;
}
}
?>It's okey but xmlsitemap_node_get_timestamps() doesn't requires full-loaded node at all. It's enough just node->nid as argument.
Comments
#1
Here the patch
#2
#3
The last submitted patch, 1856572-2-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch, failed testing.
#4
#1: 1856572-2-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch queued for re-testing.
#5
The last submitted patch, 1856572-2-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch, failed testing.
#6
#7
The last submitted patch, 1856572-6-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch, failed testing.
#8
Third try
#9
The last submitted patch, 1856572-8-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch, failed testing.
#10
I think this is a won't fix. Dave Reid, can you please chime in on this?