I have setup permalinks on my drupal forum, but I am not happy with the link they produce. They point to /comment/cid/#comment-cid. It makes more sense to point to the node, ie /node/nid#comment-cid. This way you are sent to the node page, you dont get duplicate page problems with search engines, and it just makes more sense.
The following are lines 241 to 244 of permalink.module.
// Send the link to the custom comment page.
$link['href'] = 'comment/'. $object->cid;
$link['fragment'] = 'comment-'. $object->cid;
}
I tweaked it as follows.
// Send the link to the custom comment page.
$link['href'] = 'node/'. $object->nid;
$link['fragment'] = 'comment-'. $object->cid;
$link['attributes']['class'] = 'disable-active';
}
With url_alias module enabled, the node/nid part automatically changes, so the link is perfect! (ie it is /forum/threadtitle#comment-cid)
I added the extra class because all the comment permalinks became active on the node. I added this css to my theme template, maybe you could get it to work via the permalink.css file though?
li a.active.disable-active {
color: #228BC8;
}I think this would be a good feature to implement to your module, perhaps with an option on the settings page to choose the link as /comment/... or /node/...
Comments
Comment #1
abx commentedWhat you're trying to do will not work on multiple comment pages. Just tried that with second comment page. If what you want is /node/... then, just uninstall Permalink. It's the way Drupal always works. No need for this module at all.
Comment #2
neRok commentedI cant remember what I was thinking back then, but a comment is on a node, so the comments link should be to a place on the node (logic would say). Although, by the sounds of it, D7 works the same way as this module does.
I never got to testing the multipage point.
At least this code is written down if anyone wants to hack their module in the future. I will close this for you.