Ticket #217 (new enhancement)

Opened 3 years ago

Last modified 3 years ago

Implementation of rel=canonical

Reported by: dime Owned by:
Priority: normal Milestone: 1.1
Component: General Version:
Severity: normal Keywords:
Cc: tracs@…

Description

I think this is not complicated so it doesn't need thread on forum and special explanation.

A month ago all four major search engines introduced support for rel=canonical (you can read announcements from  Google,  Yahoo,  Microsoft and  Ask). More read  here and  here.

So what we need here is that in <head> rel=canonical is placed with URL that should be default URL for that page (i.e. if cruft-free URLs aren't turned on that URL will be like  http://example.com/?level=album&id=1 even though visitor opened URL  http://example.com/?level=album&id=1&PHPSESSIONID=f773365029e9d5c9e82849da29fdc6c1&something=value and if cruft-free are turned on then URL should be like  http://example.com/colection/album/ even if visitor opened any of two previous mentioned URLs or something like  http://example.com/colection/album/?utm_source=adwords&utm_medium=cpc&utm_term=title&utm_content=album&utm_campaign=plogger (all combinations point to same page).

This should be implemented in core, not in themes.

Change History

comment:1 Changed 3 years ago by sidtheduck

Again, see my response to ticket #170 and how this may or may not be included in the core or as a future plugin as not everyone needs / wants this functionality.

For the time being, you can add this to your head.php in your theme:

<link rel="canonical" href="<?php echo generate_url($GLOBALS['plogger_level'], $GLOBALS['plogger_id']); ?>" />

and it should work for you.

comment:2 Changed 3 years ago by dime

I can't agree that this is same situation as #170 and that is not something for all users because this partly solve one of problems Plogger makes by creating duplicate content (same pages on different URLs). This will get in WordPress? core for next release and I think that is example that this is not only for some users.

BTW, thanks for code, it works but problem is with collections/albums with multiple pages since on all pages it shows URL of first page.

comment:3 Changed 3 years ago by kimparsell

  • Milestone changed from 1.0 to 1.1
Note: See TracTickets for help on using tickets.