Support » Plugin: Asset CleanUp: Page Speed Booster » Tip: Remove the post relational meta tag “next”

  • Resolved moisb

    (@moisb)


    Hi. The option “Remove Post’s Relational Links tag?” remove only the previous tag.

    would not be more complete if also removed the next tag (<link rel=”next”)?

    I use ajax scroll auto load for my custom post type content, and Google are indexing links “mywebsite.com/blog/page/2” that do not exist (returning 404)
    I suspect it’s the <link rel=”next” meta tag that makes Google index these links

Viewing 1 replies (of 1 total)
  • Hello. I researched a bit more and found a more appropriate solution. Instead of removing the “next” and “previous” meta tags (introduced by Yoast SEO) from the entire website, I made only for home page and my custom taxonomy, by Yoast filter bellow:

    /* Remove Yoast SEO Prev/Next URL on some pages
     * Credit: Yoast Team
     * Last Tested: Jun 10 2017 using Yoast SEO 4.9 on WordPress 4.8
     */
    add_filter( 'wpseo_next_rel_link', 'custom_remove_wpseo_next', 10 );
    add_filter( 'wpseo_prev_rel_link', 'custom_remove_wpseo_prev', 10 );
    function custom_remove_wpseo_next( $link ) {
         /* Make the magic happen here
          * Example below removes the rel=”next” link
          */
         if (is_tax( 'mycustomtax' ) || is_front_page() ) {
              return false;
         } else { 
              return $link;
         }
    }
    function custom_remove_wpseo_prev( $link ) {
    	     /* Make the magic happen here
          * Example below removes the rel=”previous” link
          */
    			if (is_tax( 'mycustomtax' ) || is_front_page() ) {
              return false;
         } else { 
              return $link;
         }
    }

    from: https://gist.github.com/amboutwe/66c583d2ef4015a8a244ee3e0e8cd1a0

    • This reply was modified 5 months, 3 weeks ago by  moisb.
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.