I've enabled the permalink module on a new site I'm putting together. I have it enabled for my news content type. When I create a new news item the pathauto alias is: http://www.example.org/news/2009/11/15/first-news-article. When I hover my mouse over the permalink I get the same exact URL. Is that correct?

For the same node I've also added a comment. When I hover my mouse over the comment subject I get this URL: http://www.example.org/news/2009/11/15/first-news-article#comment-1 and when I hover over the permalink I get this URL: http://www.example.org/comment/1#comment-1.

Did I misunderstand what this module does? I was thinking it would create links to node/[nid]. Is that correct?

Does this module conflict with any other modules?

Comments

CaptDrake’s picture

Assigned: Unassigned » CaptDrake
Status: Active » Postponed (maintainer needs more info)

After extensive testing, we were unable to replicate the issue you've identified with the pathauto alias. We (correctly) saw a link to the node/[nid] using the permalink.

The statement regarding the comment is true. Since a comment cannot have a node value, this path will navigate to the correct comment (no matter how many pages down it may be).

There are no known conflicts with any other modules.

bkosborne’s picture

Status: Postponed (maintainer needs more info) » Active

I have the same issue, tho I'm not using pathauto.

However, what's strange is that I've enabled the option to display the copy box at the bottom of the node and the path that is displayed there for the user to copy is indeed the correct node path (without the alias). But the actual permalink link is the alias'ed path...

soulfroys’s picture

I have the same issue too + pathauto.

Treidge’s picture

+1, same here. But I did some research and managed to figure out this: if use fresh Drupal installation - there is no problem with Permalink and Path/Pathauto. Then I tried to disable all contributed modules in test copy of my production site to check if any of them is the cause of wrong behavior of Permalink - and nothing changed, URL's still was constructed with node alias instead of ID even when only Core modules was enabled. So I think at some stage of site development/usage something happens that affects Permalink and this "something" can not be reverted by disabling other modules.

Looks like developers will need a copy of Drupal installation where this problem happens, so I can provide such copy to help fix this. If anyone interested - write a comment here or contact me, I will prepare test copy for this purpose.

bkosborne’s picture

@Treidge, did you flush caches throughout that process?

Treidge’s picture

Yes, I did it through Performance menu and manually cleared cache_* tables in database with no effect. But I think I found "a root of evil".

Surprisingly for me it was a theme-related problem. Somehow template.php of my theme ( I'm using Blogbuzz ) affects how URL's in "Links" section are constructed - if I switch theme to another, then Permalink works fine. I will post this bug on theme project page. Maybe you guys should check your theme for this too.

caschbre’s picture

@Treidge... can you link to the bug you post or describe what the theme is doing? That way we can investigate other themes that may be doing something similar.

Treidge’s picture

There it is: #1004288: Blogbuzz conflicts with Permalink module

Actually I have nothing to add as additional description, all that I managed to figure out is in #6 - something happens in template.php file of theme, most likely it's some function that pre-processes URL's in Links section and such way they are changed by this theme function.

Most simple way to check if your theme is affected - change it to Garland ( Drupal core theme ) and see if Permalink works correctly. Garland theme does not have this issue.

todd nienkerk’s picture

Assigned: CaptDrake » todd nienkerk

Treidge, bkosborne, and caschbre: Are you all using non-Garland themes? What happens when you switch to Garland -- does Permalink work then?

Treidge’s picture

Yep, for me that's correct: if I switch to Garland theme - Permalink works as expected, pointing to NodeID in URL.

And - wow, after I looked into it one more time right now - I've managed to understand what's wrong with my theme, or better to say - how to fix it.

As I mentioned above - the problem was in template.php function that processes Links section under node body. In my theme ( Blogbuzz ) function was like this:

function blogbuzz_links($links, $attributes = array('class' => 'links')) {
  $output = '';

  if (count($links) > 0) {
    $output = '<ul'. drupal_attributes($attributes) .'>';

    $num_links = count($links);
    $i = 1;

    foreach ($links as $key => $link) {
      $class = $key;

      // Add first, last and active classes to the list of links to help out themers.
      if ($i == 1) {
        $class .= ' first';
      }
      if ($i == $num_links) {
        $class .= ' last';
      }
      if (isset($link['href']) && $link['href'] == $_GET['q']) {
        $class .= ' active';
      }

	  $output .= '<li class="'. $class .'">';

     // Is the title HTML?
      $html = isset($link['html']) && $link['html'];

      // Initialize fragment and query variables.
      $link['query'] = isset($link['query']) ? $link['query'] : NULL;
      $link['fragment'] = isset($link['fragment']) ? $link['fragment'] : NULL;

      if (isset($link['href'])) {
        $link_options = array('attributes'  => $link['attributes'],
                              'query'       => $link['query'],
                              'fragment'    => $link['fragment'],
                              'absolute'    => FALSE,
                               'html'        => $html);
        $output .= l($link['title'], $link['href'], $link_options);
      }

      else if (!empty($link['title'])) {
        // Some links are actually not links, but we wrap these in <span> for adding title and class attributes
        if (empty($link['html'])) {
          $link['title'] = check_plain($link['title']);
        }
        $span_attributes = '';
        if (isset($link['attributes'])) {
          $span_attributes = drupal_attributes($link['attributes']);
        }
        $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>';
      }

      $i++;
      $output .= "</li>";
      $output .= " \n";
    }
    $output .= '</ul>';
  }

  return $output;
}

For fixing the problem I put into

 $link_options = array('attributes'  => $link['attributes'],
                              'query'       => $link['query'],
                              'fragment'    => $link['fragment'],
                              'absolute'    => FALSE,
                               'html'        => $html);

following line:

'alias' => TRUE,

so it's become like

$link_options = array('attributes'  => $link['attributes'],
                              'query'       => $link['query'],
                              'fragment'    => $link['fragment'],
                              'alias'       => TRUE,
                              'absolute'    => FALSE,
                               'html'        => $html);

I believe that same can be applied to other themes. I'm not Drupal coder, but 'alias' => TRUE makes Drupal think that supplied by Permalink module URL is already aliased, so Drupal don't look for it's real alias in DB when page is generated. But, if in Links you have some other URL's that must be aliased - it may be the problem... At least for me that's not the case, so I can end with this solution.

Hope that helps.

todd nienkerk’s picture

Status: Active » Closed (won't fix)

Treidge: Thanks for the thorough explanation. This will be very helpful for other theme developers who might come across this issue.

soulfroys’s picture

#10 works great!

caschbre’s picture

Sorry... missed responding to this earlier.

I was using acquia_marina. I've since upgraded to the latest acquia_marina using the the fusion base theme. I see this issue but haven't quite narrowed down where in the template.php file it's being overwritten. I may need more help from those who know theming a bit better.

Treidge’s picture

Hmm... That's strange, I've tried acquia_marina and fusion for Drupal 6 and permalink seems to work just fine. Also I've checked template.php for acquia_marina and fusion themes and didn't find anything related to this issue - looks like by default this themes not overwriting this function.

asb’s picture

Issue summary: View changes

I'm encountering a similar issue with Fusion and Acquia_Prosper. An alternative to hacking the the is not to use the module but to build a block with Views.