If the canonical field is empty the meta tag is still generated as the URL of the node. Is this by design?

Correct me if I am wrong, but is it not the case that canonical URLs are supposed to send a search engine crawler elsewhere - what does noting the current page as the canonical adress do?

I am very new to websites compared to most people here, so this may be a non-issue. If it is, I apologize.

Comments

damienmckenna’s picture

Issue tags: +v6.x-1.12 blocker

Sounds like it needs to be verified & fixed for the next release.

dave reid’s picture

Status: Active » Closed (cannot reproduce)

I cannot duplicate this with the current code (6.x-1.x).

kalis1’s picture

Status: Closed (cannot reproduce) » Active

I confirm the bug, which happens when you've previously set a canonical url, and then erase it. In this configuration, the canonical meta displayed in the source code is equal to the node's path...

damienmckenna’s picture

Version: 6.x-1.11 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new969 bytes

I believe this is working in the current 6.x-1.x codebase because of the following:

  $tags['canonical'] = !empty($content['value']) ? check_url(url($content['value'], $options)) : '';

This will not pass an empty string to the url() function, thus if no path string is available it will not try to display anything.

All the same, here's a tiny tweak.

damienmckenna’s picture

StatusFileSize
new421 bytes

The tweak rerolled.

3dloco’s picture

Thanks Damien, patch in #5 works for me.

damienmckenna’s picture

Status: Needs review » Fixed

@3dloco: Thanks for the review. This fix has been committed.

Status: Fixed » Closed (fixed)
Issue tags: -v6.x-1.12 blocker

Automatically closed -- issue fixed for 2 weeks with no activity.