Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Overridden node page views are missing a default drupal 7 feature that includes canonical links to prevent duplicate content. http://api.drupal.org/api/drupal/modules%21node%21node.module/function/n...
This patch restores that functionality.
Comment | File | Size | Author |
---|---|---|---|
#8 | 1444598-6-8-interdiff.txt | 2.44 KB | rivimey |
#8 | ctools_canonical_link_node_view-1444598-8.patch | 3.43 KB | rivimey |
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedI didn't even know about this feature. Neat. Committed, pushed.
Comment #3
iSoLate CreditAttribution: iSoLate at Randstad Digital commentedCommit 05d7202ef562b90fa1cf8c541ac3ef0b35077613 removed this code, making our canonical links to be broken...
Comment #4
iSoLate CreditAttribution: iSoLate at Randstad Digital for Government of Flanders commentedAdded patch for 7.x-1.9.
Comment #5
iSoLate CreditAttribution: iSoLate at Randstad Digital for Government of Flanders commentedAdded a test for this.
Comment #6
angel.hThe test in #5 always succeeds, even without the patch. This was because the node that was created by the test was not handled by Page manager at all.
I fixed that, plus some coding standards and the fact that it was not working in sub-directory installation. I upload interdiff, tests only and the new patch.
Comment #7
rivimeyPatch applies properly, and it has tests :-) and the tests run fine and fail when the changed code is reverted.
I am assuming that the change itself is a good one to make - it seems so, but there is a niggle in my head that changing existing behaviour (however broken) in this way might not be good. If someone had worked around the failure would they need to change? If so, I think we need to flag this in the release notes, at the very least.
There are a couple of review comments, but nothing serious. Proposing RTBC for 1.13 if we can get the above sorted.
Two thoughts about these lines:
- is it possible in this case for entity_uri() to return something other than the expected array? if so we need to check $uri before use;
- the lines are long and would benefit from being reformatted onto multiple lines.
Yay!! someone providing test coverage :) thanks.
Recent changes have settled on 'ctools' for the test group.
Comment #8
rivimeyOk, I have implemented a change to #6 which addresses my review comments; I hope the changed code in node_view.inc is appropriate.
I have also modified the test file group and added descriptor strings to two asserts.
It should be noted that the tests intentionally create a 404 not found error; this is not a bug!
Comment #9
rivimeyComment #11
japerryLooks good to me, and love the test. Committed!