Drupal canonical meta tags for pager URLs

As a quick note, I was just about to write a Drupal 6 module to add "rel=canonical" meta tags to Drupal pager pages (pager URLs), so URLs that look like this:

http://www.devdaily.com/blog?page=47

or this:

http://www.devdaily.com/java/?page=1

would have the rel="canonical" meta tag added to them, but after a little more googling, I found this isn't necessary if you're using the Drupal Nodewords, which hopefully you are already doing. (This module is available and highly recommended for Drupal 6, but is not currently available for Drupal 7.)

Once you have the Drupal 6 Nodewords module installed and enabled, go to this URI:

/admin/content/nodewords

and then:

  1. Make sure you include the canonical URL in the HTML output.
  2. Check/enable the "Repeat meta tags for lists" checkbox.
  3. Make sure you enter a Base URL (like "http://www.devdaily.com") as well.

If you do this, and then check your Drupal pager URLs, you should see the canonical meta tag show up in your HTML source code, and URLs like this:

http://www.devdaily.com/blog?page=47

should have a canonical URL like this:

http://www.devdaily.com/blog

I just did this on this website, and it's working just fine.

Add new comment

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.