The canonical tag is missing from the front page. However, all the inner pages contain it. Add the canonical tag into the front page:

This is a problem because right now all the Drupal sites have duplicate content on the front page. These are all duplicates:

http://example.com/
http://example.com/node
http://example.com/node/

The best solution would be to automatically 301 redirect http://example.com/node to http://example.com/, but until that the canonical tag is a good solution.

And if you promote your front page using Google Adwords, you end up with duplicate content, too:

http://example.com/?gclid=CJeVnMD30qUCFc0g3wodRT1Jjw

That's why the canonical tag is a must-have on the front page, and on all pages.

CommentFileSizeAuthor
#8 drupal.canonical.8.patch3.39 KBsun

Comments

Bence’s picture

Title: Add the canonical tag into the front page » SEO issue: duplicate content on every URL, insert the canonical tag into every URL
Version: 7.0-rc1 » 7.x-dev
Component: node system » path.module
Category: task » bug
Priority: Normal » Major

It turned out that only the content types have the canonical tag, but every URL, generated by Drupal core or modules, must have the canonical tag.

Google doesn't like duplicate content: http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=66359

They suggest to use canonicalization, or 301 redirect: http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=139066

Now, Drupal doesn't use 301 redirect, I think the canonicalization method is easier to implement. There is a module called "Global Redirect", which I think should move into the core, because if fixes all the duplicate content issues in Drupal.

Currently Drupal is generating infinite number of duplicate content for each and every URL. For example, let's say this is the original URL, and I enabled clean URLs and custom paths: http://example.com/?q=node/1.
And my custom path for that node is http://example.com/about.

Then these are all duplicates, they must have a canonical tag which points to http://example.com/about:

http://example.com/?q=node/1
http://example.com/?q=node/1/
http://example.com/?q=node/1/////
http://example.com/?q=node/1?
http://example.com/?q=node/1/////???///
http://example.com/node/1/
http://example.com/node/1
http://example.com/about/
http://example.com/about?
http://example.com/nóde/1

(see #301373: Paths with non-ASCII characters do not redirect, create "duplicate content" issues)
http://example.com/nódé/1 (see #301373: Paths with non-ASCII characters do not redirect, create "duplicate content" issues)

etc.

This problem occurs at every URL generated by Drupal core or modules. For example, taxonomy links, user profile links, /tracker etc.

Inserting the canonical tag into all URLs solves this problem, and also provides a workaround for #301373: Paths with non-ASCII characters do not redirect, create "duplicate content" issues.

The front page has also duplicate content:

http://example.com/
http://example.com/node
http://example.com/node/
http://example.com/node?page=2
http://example.com/?page=2

I think http://example.com/node?page=2 should point to http://example.com/?page=2.

So the canonical tag must be inserted into all generated URLs. It would be also a good idea to move the functionality of the module "Global Redirect" into core.

XiaN Vizjereij’s picture

Subscribing

marcingy’s picture

Version: 7.x-dev » 8.x-dev
Category: bug » feature

This is a feature request the concept of redirects is supported by the global redirect module so bumping to d8.

Bence’s picture

Version: 8.x-dev » 7.x-dev
Category: feature » bug

That is (redirects) a separate issue. This issue is about inserting the canonical tags into all URLs. Content types have the canonical tag, so why not add it to all pages? This will resolve the duplicate content issue.

Even if you don't have a Drupal site, just let's say static HTML files, you still should use the canonical tag on ALL pages. And even if you redirect the pages to prevent duplicate content (for example, with Global Redirect), you still need the canonical tags, because of the tracking parameters, like Adwords campaigns, email campaigns, Google Analytics tracking links, affiliate program tracking URLs etc.

Take a look at Matt Cutt's blog: http://www.mattcutts.com/blog
EVERY URL contains the canonical tag, even category/tag archives, pages, posts etc.

This is a bug report, because Drupal generates infinite number of duplicate content. Is this the right behavior? I don't think so.

Question: the /node path should point (via the canonical tag) to / (the root), right? For example, this URL:
http://www.example.com/node should have this canonical tag:
<link rel="canonical" href="http://www.example.com/" /> ?

If this issue was fixed, then the upgrade documentation should mention that before upgrading to Drupal 7, it is a good idea to disable modules which generated canonical tags (to prevent duplicate canonical tags), or disable that feature (canonical tag generation) in that modules before upgrading.

bojanz’s picture

Version: 7.x-dev » 8.x-dev
Category: bug » feature

Drupal 7 is done.
The only changes getting in right now are small bugfixes.
You have a feature request, because even though this is bad, it can be easily rectified with a contrib module.

Bence’s picture

But someone added the canonical tag to content types, but forgot to add it to all URLs. Isn't it a bug? This feature is only 50% complete.

And there is no module right now which can generate proper canonical tags in Drupal 7, so looks like Drupal 7 will ship with weak SEO capabilities.

I don't understand why would this break contributed modules, since there is not a single module for Drupal 7 which generates canonical tags... And contributed modules should be already aware of the fact that Drupal core generates canonical tags on some pages.

Bence’s picture

Version: 8.x-dev » 7.x-dev
Category: feature » bug
sun’s picture

Priority: Major » Normal
Status: Active » Needs review
StatusFileSize
new3.39 KB

Something along these lines might work.

Status: Needs review » Needs work

The last submitted patch, drupal.canonical.8.patch, failed testing.

Bence’s picture

Title: SEO issue: duplicate content on every URL, insert the canonical tag into every URL » Insert the canonical tag into all content, not just into nodes
Version: 7.x-dev » 8.x-dev
Category: bug » feature

Assigning this to 8.x-dev, I think this won't make into Drupal 7.

I don't understand that why is the canonical tag present only in nodes? Non-nodes have duplicate content, too.

matt b’s picture

Issue summary: View changes

The excellent metatag module (https://www.drupal.org/project/metatag) allows you to specify the canonical tag on individual pages. Fixed for Drupal 7, looks like the maintainers are porting this to Drupal 8. Suggest this can be closed?

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +stale-issue-cleanup

Thank you for sharing your idea for improving Drupal.

We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

Thanks!

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Since there's been no follow up and this was a feature request going to close out. If still desired please re-open

Thanks all

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.