The canonical link element isn’t set for all pages. For example, if I look at the source code for a post, I can see the following in the <head>:

<link rel="canonical" href="http://example.com/post-name/" />

However, if I look at the source code for an author archive page, I don’t see the link element.

Why isn’t the canonical link element used for all pages?

Reference

I’ve included below the function used by WordPress to output the canonical link element.

/**
 * Output rel=canonical for singular queries.
 *
 * @since 2.9.0
*/
function rel_canonical() {
    if ( !is_singular() )
        return;

    global $wp_the_query;
    if ( !$id = $wp_the_query->get_queried_object_id() )
        return;

    $link = get_permalink( $id );

    if ( $page = get_query_var('cpage') )
        $link = get_comments_pagenum_link( $page );

    echo "<link rel="canonical" href="https://wordpress.stackexchange.com/questions/165192/$link" />\n";
}

2 Answers
2

It’s not like every single page is magically better with canonical link. The technical purpose of canonical link is to de–duplicate identical or nearly–identical content at different URLs.

It doesn’t make sense for archives because they are :

  • collections of content
  • moving target, what is on front page or archive right now won’t be there after new posts are made

While it would make sense to add canonical for some archive implementations, it doesn’t fit typical WordPress archives well.

Leave a Reply

Your email address will not be published. Required fields are marked *