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.
The canonical link element on the front page seems to be set incorrectly if the front page is set to something other than default. If the front page is set to say, 'node/200', then the canonical link element on the home page will be 'node/200' instead of the base domain, which it should be IMO.
Comment | File | Size | Author |
---|---|---|---|
#7 | Screen Shot 2014-08-25 at 16.25.54 .png | 27.93 KB | miro_dietiker |
Comments
Comment #1
idevai CreditAttribution: idevai commentedSame here. Actually I don't know how to fix this using the admin interface.
What I did was something like this in template.php:
Hope this helps.
Comment #2
dmitrii CreditAttribution: dmitrii commentedThank for your code.
my template.php
Comment #3
friendlymachine CreditAttribution: friendlymachine commentedThanks to both of you for posting a workaround.
Comment #4
artfulrobot CreditAttribution: artfulrobot commentedThanks for fixing this dumb behaviour which was (amongst other things) breaking my Tweet button (which was picking up the node/123). It's good to have a canonical URL because it provides clarity. No good if that "clarity" is wrong/confusing!
Comment #5
smitty CreditAttribution: smitty commentedI think this should be fixed in the Global Redirect module. As soon as you switch on the »Frontpage Redirect Handler« to redirect any request to the frontpage path to the site root the canonical URL (inserted by Drupal Core) must be deleted or set to the site root.
Comment #6
miro_dietikerIMHO: This is a pretty major thing.
In case the front page is set to a node, the code for page_node_view adds the node/ID canonical element.
https://api.drupal.org/api/drupal/modules%21node%21node.module/function/...
In that case, formally, the front page represents the node. This is why core can claim, setting it to canonical node/ID_FRONT is not wrong.
Now, global redirect adds a redirect header to the node/ID_FRONT page, resulting in a circular redirect. This is fatal.
Since a week now, facebook stops counting likes / shares for such pages. (Before i haven't seen this issue.)
Facebook offers a developer tool to resolve header + open graph tags.
https://developers.facebook.com/tools/debug/
If you add your front page URL here, you will see the fatal error:
And we ended in trouble with blocked and resetted sharing counters. See here how to query the records: http://stackoverflow.com/questions/5699270/how-to-get-share-counts-using...
Resulting in this conclusion:
If open graph forces node/ID_FRONT to redirect to front page, it needs to fix canonical of at least front page too. Possibly also node/ID_FRONT.
Comment #7
miro_dietikerAdditionally providing the screen of the Facebook URL debugger error.