[Resolved] Infinite Scroll and Pagination in HTML

Home Forums Support [Resolved] Infinite Scroll and Pagination in HTML

Home Forums Support Infinite Scroll and Pagination in HTML

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1581639
    The Witney SEO Guy

    Quickly want to say that I’m loving using GeneratePress.

    One minor issue is that I’ve enabled Infinite Scroll but I’m still getting URLs like /blog/page/2/ in the HTML.

    I’d like to remove these from the HTML if possible.

    Would anyone be able to provide me with the necessary code to do this?

    Thanks

    #1582025
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    Where in the HTML are you seeing those URLs?

    #1582078
    The Witney SEO Guy

    It appears in the rel=next and rel=prev attributes.

    It also appears in the post navigation section which should appear at the bottom of the page. I’m assuming this is set to display: none in the CSS?

    You can see them in the HTML on this page: https://witneyseoguy.co.uk/blog/

    #1583362
    Tom
    Lead Developer
    Lead Developer

    WordPress itself adds the rel="next" and previous tags in wp_head – your SEO plugin may be able to remove those?

    As for the pagination – it is set to display: none. Infinite scroll actually uses the hidden “Next” link to know where to get posts from next.

    #1586750
    The Witney SEO Guy

    Okay great, thanks for that. I use Yoast SEO so I’ve disabled the rel=next and rel=prev by adding the code below to functions.php:

    <?php
    /********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
    
    /* Remove Yoast SEO Prev/Next URL from all pages
     * Credit: Yoast Team
     * Last Tested: Jun 10 2017 using Yoast SEO 4.9 on WordPress 4.8
     */
    
    add_filter( 'wpseo_next_rel_link', '__return_false' );
    add_filter( 'wpseo_prev_rel_link', '__return_false' );
    

    I’m guessing the remaining links can’t be removed then if they’re used by infinite scroll? It would be nice if there were a way for this to work without those links being output. Any plans for development there?

    #1587432
    Tom
    Lead Developer
    Lead Developer

    It hasn’t really come up before. Is there an issue with having the pagination set to display: none?

    #1588261
    The Witney SEO Guy

    Not a huge issue, but I’d prefer the second page didn’t get linked as it’s redundant when infinite scroll is enabled.

    I think I’ll just disable infinite scroll for now.

    Thanks for your help.

    #1588403
    Tom
    Lead Developer
    Lead Developer

    No problem!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.