In some cases, calling taxonomy_term_path seems to return the wrong path. This line #478 in site_map.module:

$term_item .= l($term->name, ($cat_depth < 0) ? taxonomy_term_path($term) : "taxonomy/term/$term->tid/$cat_depth", array('attributes' => array('title' => $term-> description)));

could be simplified to:

$term_item .= l($term->name, ($cat_depth < 0) ? "taxonomy/term/$term->tid" : "taxonomy/term/$term->tid/$cat_depth", array('attributes' => array('title' => $term-> description)));

to avoid the bad path alias problem. Somehow, taxonomy term path is, for certain vocabularies, adding the domain name and / to the path. So, you end up with a path like http://www.drupal.org/www.drupal.org/someterm-path-alias. It only happens when I set the path depth setting to -1 in the sitemap config. It doesn't happen for all of my vocabs either, just the one that is not multiple select and only has one content type assigned. Very strange.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

frjo’s picture

Category: bug » support

I think you have some other module that is messing up the path.

Take a look in your database, table "vocabulary", and see what "module" is set to for each vocabulary. My guess is that it's something other than "taxonomy" for the ones that gives you problem.

http://api.drupal.org/api/function/taxonomy_term_path/6

wiifm’s picture

Also having a similar issue with my taxonomy URL aliases. Have tried version 1.1 and the latest dev version 2, both producing the same (unfriendly) output (e.g. 'http://localhost/taxonomy/term/31/all' - instead of 'http://localhost/taxonomy/term/green/all').

I have checked the table in question in the drupal database, and the module for all 10 of my taxonomies is set to 'taxonomy'.

Can @lutegrass's code suggestion by implemented, or is there a better way to fix this issue?

Michsk’s picture

Version: 6.x-1.1 » 6.x-1.2

i have the same issue, aliases for taxonomy and vocabulary are ignores.

The only modules used for vocabulary are taxonomy and forum. Version 1.2

DamienMcKenna’s picture

FileSize
1.92 KB

How about something like this? (site_map.module line 496 onwards)

    // Work out if the term path is being overridden.
    $raw_path = 'taxonomy/term/'. $term->tid;
    $term_path = taxonomy_term_path($term);
    // Compile the feed URL.  If the term path is not being overridden the
    // depth can be added.
    if ($raw_path == $term_path) {
      $feed_path = $term_path .'/'. $cat_depth .'/feed';
    }
    else {
      $feed_path = $term_path .'/feed';
    }
    // Only create an actual link if there is content tagged with this item.
    if ($term->count) {
      $term_item .= l($term->name, $term_path, array('attributes' => array('title' => $term->description)));
    }
    else {
      $term_item .= check_plain($term->name);
    }

Then change the $rss_link generation to:

      // Use the term_path generated earlier.
      $rss_link = theme('site_map_feed_icon', $feed_path);

(patch against DRUPAL-6--2 branch attached)

DamienMcKenna’s picture

FileSize
2.01 KB

The correct patch is attached.

srobert72’s picture

Subscribing

srobert72’s picture

@DamienMcKenna
Thank for your patch

I've just tested #5 patch and here is feedback.

Taxonomy URL are properly written now.
But URL under Feed icons are always wrong.

srobert72’s picture

Category: support » bug

Changed to BugReport.
Site_map seems not compatible with PathAuto in this particular case.

srobert72’s picture

Priority: Normal » Critical

Is there any news ?

Really annoying because it duplicates all taxonomy URL for same term.
Result is very bad for SEO.

srobert72’s picture

Very strange, problem has disappeared...
But there was no patch commited in Sitemap module since I've posted comments in this issue.

Maybe it has been fixed by recent updates in another module like PathAuto.

@schaub123
@wiifm69
@lasac
@DamienMcKenna
Do you still reproduce this issue ?

vpapadim’s picture

Subscribing

vpapadim’s picture

that worked for me! thanks for the patch

ressa’s picture

This is still happening in the latest version, 6.x-2.1 as well as 6.x-2.x-dev

The #5 patch:
Fixes taxonomy URLs.
Feed icons are still in the taxonomy/term/80/all/feed format.

everypcneed’s picture

I was able to edit the file successfully and can confirm taxonomy terms are now updating correctly with PathAuto settings.