Hi,

Fist of all, thanks for the great module!
Hope somebody can help me with using the hook mentioned above.

As far as I understand from the documentation, just dumping all links in the database should be enough? Code below returns the urls to a special vocabulary used by Ubercart which does not show in sitemaps.

How could I use the hook to let them show?

Hope somebody could help,

Br
Mark

global $base_url;

$tree = taxonomy_get_tree(variable_get('uc_catalog_vid', 0));

foreach ($tree as $term) {
  $link[] = array(
    'loc' => $base_url .'/'. drupal_get_path_alias(uc_catalog_path($term)),
    'lastmod' => 0,
    'changefreq' => 0,
    'priority' => 0.8,
  );
}
dprint_r($link);

Comments

avpaderno’s picture

Component: xmlsitemap.module » Code

hook_xmlsitemap_links() is thought to be used by third-party modules to add links not handled by already existing modules; in the case reported, there is already xmlsitemap_term.module, which handles the taxonomy term links. If you are not seeing the links associated with a particular vocabulary, then maybe that vocabulary is not selected to be included in the site map.

There is no need to implement hook_xmlsitemap_links() in this case.

avpaderno’s picture

Title: How to use hook_xmlsitemap_links » How to use hook_xmlsitemap_links()
splash112’s picture

Hi Kiam,

Thanks for your quick reply!

Still this case is a little different. True that the Ubercart catalog also has an "normal" taxonomy term which gets an term/path but in addition Ubercart will supply the term with an additional path. So every term will have 2 paths, 1 automatically included in xmlsitemap, but which is rarely used (and I excluded from the sitemap) and the important one which is not...
I have simply no idea why the guys at Ubercart chose for an extra path, but I still would like to include it in the sitemap.

I still hope to write a small module to do this and get the right paths in the sitemap.

Thanks
Mark

avpaderno’s picture

This would not be a problem if Ubercart would implement hook_term_path(). The hook is not documented for Drupal 5, but from the code of the taxonomy_term_path() function is clear that such hook is called from the function.

function taxonomy_term_path($term) {
  $vocabulary = taxonomy_get_vocabulary($term->vid);
  if ($vocabulary->module != 'taxonomy' && $path = module_invoke($vocabulary->module, 'term_path', $term)) {
    return $path;
  }
  return 'taxonomy/term/'. $term->tid;
}

To notice that the function doesn't directly handle the taxonomy terms for forum.module for which would return the generic value ('taxonomy/term/'. $term->tid).

To create a new module just to handle the Ubercart taxonomy terms is possible, but would conflict with the module that already handles the taxonomy term links.

splash112’s picture

Status: Active » Fixed

Many thanks!

Worked like a charm. Fixed a function and suggested it with Ubercart:
http://drupal.org/node/425984

Best regards
Mark

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.