Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #872333

    Hi!
    I can’t get Yoast to generate meta content rel=”next” and rel=”prev” on pages that are paginated (news posts)…
    It is supposed to work automatically, but I guess there’s a conflict with the theme.

    it should have this in the header:
    <link rel=”canonical” href=”https://website.com/page/3/&#8221; />
    <link rel=”prev” href=”https://website.com/page/2/&#8221; />
    <link rel=”next” href=”https://website.com/page/4/&#8221; />

    I found this : https://kb.yoast.com/kb/is-the-plugin-compatible-with-paginated-content/
    but need for not only the home page…

    Can anyone help me on this?
    Thank you,
    Melanie

    #873113

    Hey Melanie,

    Your front page is built with the Advanced Layout Builder and so there are no buttons there. The only ones that I see are on the slider in the team section. These are not the ones where Yoast sea can add any code to.
    Are these the buttons that you mean?

    Best regards,
    Victoria

    #873131

    Hi!
    I am not talking about any buttons…
    The pagination content is in the post hidden header
    go https://new.octanestrategies.com/en/news/page/2/
    and view page source of page

    I should see:
    <link rel=”canonical” href=”https://new.octanestrategies.com/en/news/page/2/&#8221; />
    <link rel=”prev” href=”https://new.octanestrategies.com/en/news/&#8221; />
    <link rel=”next” href=”https://new.octanestrategies.com/en/news/page/3/&#8221; />

    but the last 2 are not showing…
    It is not showing although the SEO plugins is installed. It should work automatically.
    https://webmasters.googleblog.com/2011/09/pagination-with-relnext-and-relprev.html

    Thanks
    Melanie

    #873990

    Hi,

    You can add it manually by using the following hook.

    add_action('wp_head', 'wp_head_pagination_mod');
    function wp_head_pagination_mod() {
      $page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : get_query_var( 'page' );
    
      if( ! $page ) return;
    
      $url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
      $url = substr($url, 0, strpos($url, "page"));
    
      $link_prev = $url . 'page/' . ($page - 1);
      $link_next = $url  . 'page/' . ($page + 1);
    
      $output  = ' 	<link rel="prev" href="'. $link_prev .'" />' . PHP_EOL;
      $output .= ' 	<link rel="next" href="'. $link_next .'" />' . PHP_EOL;
      echo $output;
    }

    Best regards,
    Ismael

    #924014

    Hi Ismael, i have the same problem, tried code you posted but it does not work. So now in Google search results i see also page 2 and 3 of the homepage where are listed all the articles: http://www.mysite.it/page/2 and http://www.mysite.it/page/3. I opened source html page but there are not
    <link rel=”prev” href=”http://www.mysite.it/page/2/” /> and <link rel=”prev” href=”http://www.mysite.it/page/3/” />. Thanks for your help.

    #924379

    Hi,

    I can see the link tag with the rel attribute in the page’s source code.

     	<link rel="prev" href="http://www.progettobenesserecompleto.it/page/1" />
    

    Best regards,
    Ismael

    #924453

    Ismael, where in the source code? I can’t see it.

    Thanks

    #924799

    [URGENT] I had to remove code in functions.php because it disabled all pagination links (and i get 404 error). Pagination links are in the homepage and in the articles page.
    Now pagination links in the homepage works again but that ones in the articles page (see private content) not anymore (pag 2 and 3).
    Articles contains same articles element of the homepage (so same pagination links).
    What i have done:
    – Deactivated Plugin SEO Yoast
    – Remove articles element from the homepage.

    But neither of those things worked.

    Enfold version: 4.2.6; wordpress: 4.9.4.

    How can i fix the issues?

    Thanks.

    #925305

    Ismael, i found what caused the error. If you activate “Remove the categories prefix” in the Yoast seo settings (under taxonomies, the last one), everything works again. You can mark as resolved.

    #926442

    Hi,

    Awesome. Glad that you found the issue. Please feel free to open a new thread if you need anything else. :)

    Best regards,
    Ismael

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Paginated pages not showing rel=”next” and rel=”prev”’ is closed to new replies.