Default URL for comments is comment/1#comment-1. I would like it to be [node URL]#comment-1 where [node URL] is the URL of the node on which the comment is displayed.

I have tried to use the pathauto and token module to achieve this. I had to patch the token module to add a 'current-page:object' dynamic token so I could access the node URL as a token and use it in a pathauto pattern for comments. This doesn't work.

Ideally, I would like comments to work as they do on drupal.org, for example at https://www.drupal.org/project/token/issues/919760, where each comment's URL comprises of increments from 1 and is appended to the page URL.

Is there any way of achieving this behaviour?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.