[wp-hackers] Canonical integration into core

mrmist listswphackers at mist.org.uk
Tue Feb 17 08:11:41 GMT 2009


In message <EMEWEMEW2_DELIMl1FKHk5f272bcd0b04ca4a43f6cf@?>, Mike 
Schinkel <mikeschinkel at newclarity.net> writes
>Nathan:
>
>So would you support what I proposed: adding to the core a 
>"the_canonical_url()" function for use as a template tag that does 
>essentially the following and then calling that function in header.php 
>of the themes included in core?:
>
>   function the_canonical_url() {
>     echo '<link rel="canonical" href="' . get_the_canonical_url() . '" />';
>   }
>
>   function get_the_canonical_url() {
>     return apply_filters('the_canonical_url',get_permalink());
>   }
>

FWIW this is the sort of thing that I was +1-ing into core.  (With the 
additional possibility of it being placed into the default theme.)

That's why I said in my earlier post "I can't see a reason not to do 
it", because at the end of the day it could help out the average user, 
and any power users who didn't want it would find it trivial to 
override.

To address a comment that was made earlier in this conversation, as to 
why this has not been brought up as an issue before.  The answer to 
that, for me, is that we never had stuff like this before -

url/to/my/article/
url/to/my/article/comment-page-1/

Pushing duplicate content and titles by default.

This simple little tag helps out with that in an unobtrusive fashion, 
and actually saves what could otherwise be a chunk of core or theme 
coding to patch around it.

-- 
mrmist


More information about the wp-hackers mailing list