Pagination url canonical problem for other pages

Question

I have a WordPress Page setup, named ‘Blog’, where I’ve added the WP Query to bring through my blog posts.

I also have pagination, setup on these pages such as:
example.com/blog,
example.com/blog/page/2/

But on my page 2 the canonical is still coming up as: example.com/blog

Yoast SEO is controlling this. How can I make it so that on each pagination page the canonical would be the relevant URL such as: example.com/blog/page/2/

Yoast said its meant to do this, but its not (maybe because its not an archive but instead an actual page).

This is my pagination code incase helpful:

<?php
    $big = 999999999; // need an unlikely integer
    echo paginate_links( array(
        'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
        'format' => '?paged=%#%',
        'current' => max( 1, get_query_var('paged') ),
        'total' => $loop->max_num_pages
    ));
?>
0
M.T 2 months 0 Answers 4 views 0

Leave an answer