- 🇬🇧United Kingdom catch
It probably would have made sense to fix this in 2010, but we haven't been producing old-style comment links for over 15 years now, so there are probably not many left even as ancient linkrot. Marking outdated.
Comment links used to look like this:
/node/17#comment-42
Let's call this the classic comment link. In general it does not work—never did, except if the comment happened to be on the very first page of a node display.
Drupal 7 has, thankfully, been fixed, however, the fix works only with new-format comment links that look like this:
/node/17?comment=42#comment-42
The reason for this, is that Drupal on the server (i.e. PHP in general) has no way of reading the hash part of the URL, so it has to be duplicated in the query/search part.
All preexisting classic links all over the world still don't work properly and never will, unless we do something about it.
A simplified version of the working code for issue #677082: Comment links - JavaScript solution → could be used to allow foreign links, i.e. classic comment links on non-Drupal pages to work. This would work as follows.
This requires two page calls in the hopefully infrequent case that the desired comment happens not to be on the first page.
patch
JS based URL redirection for "classic" comment links to the current format for pagination
none
...
(Not to be mixed up with Creedence Clearwater Revival :-)
I'm proposing this for 7.x-dev, because it is closely related to issue #26966: Fix comment links when paging is used. → , which has recently been closed with success, and because it is a very small change that does hardly interfere with existing code. If not that, let it go for 8.x-dev.
....
An odd recognition on the side is that we could use much simpler, nicer links that look almost like the classic ones:
/node/17?comment=42
An additional, even smaller piece of JavaScript would have to look at the URL after the page is loaded and jump down to the desired comment, just as the browser does on its own when presented with the hash part, #comment-42
. Very similar code already exists in issue
#677082: Comment links - JavaScript solution →
, so there wouldn't even be much work to do. I think it can't hurt to add that bit of code as well. Perhaps in a few years that could become the most favored comment link format.
Nothing would preclude the continued use of the additional, redundant hash part, so these formats could exist side by side.
...
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
It probably would have made sense to fix this in 2010, but we haven't been producing old-style comment links for over 15 years now, so there are probably not many left even as ancient linkrot. Marking outdated.