[wp-trac] [WordPress Trac] #18660: Enhance rel_canonical function, add filter

WordPress Trac noreply at wordpress.org
Sun Jun 16 08:24:49 UTC 2013


#18660: Enhance rel_canonical function, add filter
-------------------------------------------------+-------------------------
 Reporter:  nathanrice                           |       Owner:
     Type:  enhancement                          |  joostdevalk
 Priority:  normal                               |      Status:  assigned
Component:  Canonical                            |   Milestone:  Awaiting
 Severity:  normal                               |  Review
 Keywords:  has-patch needs-testing 2nd-opinion  |     Version:  3.3
                                                 |  Resolution:
-------------------------------------------------+-------------------------

Comment (by here):

 See also #11694

 Default core behavior in 3.5.1 causes multipage posts using <!-- nextpage
 --> to have subsequent post pages ignored / deindexed by google due to
 link rel=canonical pointing to first page of multipage post.  Compounded
 by rel=next/prev pointing to next/prev chronological post not next/prev
 page of multipage post.

 Google on Pagination
 http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1663744

 Google on Canonical
 http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394

 Stackexchange discussion :
 http://wordpress.stackexchange.com/questions/84647/multi-page-posts-do-
 not-get-indexed-by-google-due-to-canonical-urls

 works-for-me 3.5.1 :

 Add post page numbers greater than 1 to rel=canonical on multipage posts
 wp-includes/link-template.php:
 {{{
 function rel_canonical() {
 ...
     if ( $page = get_query_var('page') )
         $link = $link . "$page/";
 }}}

 Remove next/prev links from all pages in header (not ideal)
 functions.php:
 {{{
 // remove rel=next/prev links in header
 remove_action('wp_head', 'start_post_rel_link');
 remove_action('wp_head', 'adjacent_posts_rel_link');
 }}}

 ----

 Agree all related canonical issues should be handled elegantly as proposed
 , including filter.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/18660#comment:28>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list