Comment display pages are bad
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3209590. --> Reported by: [jhodgdon](https://www.drupal.org/user/155601) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>If you are looking at an API page on api.drupal.org with comments, such as:<br> <a href="https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Datetime%21DateFormatter.php/function/DateFormatter%3A%3Aformat/8.9.x">https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Datetime%21DateFormatter.php/function/DateFormatter%3A%3Aformat/8.9.x</a></p> <p>Each comment is formatted with a clickable link for the comment subject/title, which takes you to a page like:<br> <a href="https://api.drupal.org/comment/65599#comment-65599">https://api.drupal.org/comment/65599#comment-65599</a></p> <p>These pages have a bad display of the "node" that the comment is on, with the comment below.</p> <p>The problem has to do with the way we're doing comments in the API module, which are on fake "nodes" because Drupal 7 and before didn't support commenting on anything but nodes. So if you go to a "node" page and it is an API fake node, you will get redirected to the actual API page for that documentation item. But this is not happening for Comment display pages.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>1. Visit <a href="https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Datetime%21DateFormatter.php/function/DateFormatter%3A%3Aformat/8.9.x">https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Datetime%21DateFormatter.php/function/DateFormatter%3A%3Aformat/8.9.x</a> or any other page with comments on api.drupal.org.</p> <p>2. Click on a link for the subject/title of a comment.</p> <p>3. Observe the top of the page, which is very confusing/useless, as it is trying to display the "node" the comment is about.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Several possibilities of how to fix this:</p> <ul> <li>Wait until D8 version of API module. We will not be using nodes any more and our custom entities with comments will probably work better.</li> <li>Possible work-around #1 for Drupal 7 version: don't output links to the comment pages when outputting comments on API "nodes".</li> <li>Possible work-around #2 for D7: if someone tries to visit a comment display page and the comment is on an API node, redirect back to the docs page.</li> <li><strong>Possible work-around #3 for D7: Use the Comment Fragment module, which overrides these links. <a href="https://www.drupal.org/project/comment_fragment">https://www.drupal.org/project/comment_fragment</a></strong></li> </ul> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <p>a) Add the Comment Fragment module <a href="https://www.drupal.org/project/comment_fragment">https://www.drupal.org/project/comment_fragment</a> to api.drupal.org</p> <p>b) Add a recommendation on the API module documentation for D7 to use this module.</p> <h3 id="summary-ui-changes">User interface changes</h3> <p>Bad-looking comment pages will not be linked to or displayed.</p> <h3 id="summary-api-changes">API changes</h3> <p>None.</p> <h3 id="summary-data-model-changes">Data model changes</h3> <p>None.</p> > Related issue: [Issue #3024949](https://www.drupal.org/node/3024949)
issue