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.
- I am running Display Suite 7.x-2.8 which I know is older, but the relevant portion of the ds_extras_node_page_view() function has not changed between versions 7.x-2.8 and 7.x-2.14.
- My site is multilingual (i18n) - not sure if it matters.
- I am also using the Global Redirect module, but it has issues of its own when it comes to i18n and front page redirects. I don't have front page redirects enabled there, and am not having Global Redirect set canonical links.
- My site's home pages all use Panels and Panelizer, and I have Display Suite Extras enabled as well.
Display Suite Extras comes with a ds_extras_node_page_view() function which spits out a canonical link in the HTML head, overriding Drupal's default behavior from the node module. However, on the front page it was spitting it out with the path to the node, rather than the front page's path. So for example for Czech, it was spitting out "/cz/my-home-page-alias" rather than "/cz".
I wrote a small patch for Display Suite Extras which checks whether the current page is the front page and if so, use that for the canonical link, rather than the node's path. This is working for me.
Comment | File | Size | Author |
---|---|---|---|
#3 | ds-canonical_front_page-2755249-11333703.patch | 917 bytes | caspervoogt |
Comments
Comment #2
caspervoogt CreditAttribution: caspervoogt at Plethora commentedand here's the patch
Comment #3
caspervoogt CreditAttribution: caspervoogt at Plethora commentedComment #4
caspervoogt CreditAttribution: caspervoogt at Plethora commentedit's a simple enough patch - have not tested it though. I am just replacing this:
with this:
This is the same way that Global Redirects handles the front page canonical link.
Comment #5
caspervoogt CreditAttribution: caspervoogt at Plethora commented