P
P
Pro100i22020-12-02 17:42:03
Landing pages
Pro100i2, 2020-12-02 17:42:03

How to make canonical on the main page?

wordpress site.
Articles are displayed on the main page, and pagination is created page / 2, page / 3, etc.
The pages page / 2, page / 3 have canonical page / 2, page / 3, but how to make canonical for them on the main page.
What are the plugins or code. It's just that if you do a redirect, then the user will not see pages 2 and 3, etc.
And I need it purely for Google and Yandex robots.
And in the headings themselves should remain as is.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladislav Chernenko, 2020-12-02
@vladchv

<?php if( is_paged() ){ ?>
  <link rel="canonical" href="<?php echo get_site_url(); ?>" />
<?php } ?>

P
Pro100i2, 2020-12-03
@Pro100i2

When placed in the functions file, it gives an error
syntax error, unexpected '<', expecting end of file

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question