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.
/book/export/html/NID pages should have rel="canonical" pointing back at the real page. It doesn't have any.
I've found that Google is indexing some of these in preference to the real page, because they have neither rel="canonical", nor are they nuked by robots.txt.
I think this is actually a bug. It's definitely the wrong thing, and causes a bad user experience. A case could be made that it's a feature request, though, I suppose!
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedAs a work-around, I have added
Disallow: /book/export/
to robots.txt.
If it's hard to fix core with rel="canonical", this would be an interim solution, but (per Google) it's not The Right Thing.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedThis sounds as if it should be a contrib module. Certainly not a bug. What is the canonical link for /book/export/html/NID that you think should be added? I tend to use Global Redirect module for redirecting to a common URL when multiple URL is possible.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm sorry, I think you may be missing the point here. (Perhaps I misunderstand you.)
/book/export/html/NID is the "printer-friendly version" of /node/NID, provided by the book module. It has the same content but without most theming. /node/NID is the canonical version.
Global Redirect would be entirely the wrong thing. The printer-friendly version is a desired feature, a distinct URL with different HTML, and should not be 301'd to the actual page.
Comment #3.0
Anonymous (not verified) CreditAttribution: Anonymous commentedRemoving note that I will separately report the robots.txt thing as an issue. It's a less good solution.