How to Change the Yoast SEO Sitemap Link Limit

By default, the number of links in a Yoast SEO sitemap is 1,000. Some of you may feel that 1,000 links is too few or perhaps too many. Even so, you can still change the Yoast SEO sitemap link limit with some additional configuration in your WordPress site.

Before we discuss further how to change the Yoast SEO sitemap link limit, some of you may not yet know how to check the number of links in Yoast SEO.

To check the number of links in your Yoast SEO sitemap, you can visit your sitemap page, which by default is https://namadomain.com/sitemap.xml then open the sitemap page for your post type, for example https://staging.wpgan.com/post-sitemap.xml and information will be displayed This XML Sitemap contains xx URLs

Cara Mengubah Jumlah Link Sitemap Yoast SEO

Once you are on the sitemap page, you will find a table with the heading URL Count, and if this URL Count exceeds the set limit, Yoast SEO will create a new page to display the remaining links, for example by adding a page https://staging.wpgan.com/post-sitemap2.xml

  • A website using the WordPress CMS
  • The Yoast SEO plugin must be active, whether you are using the free or paid version
  • Know how to add or modify functions.php

Once your Yoast SEO plugin is active, you need to add code to your theme's functions file.

If you already know how to add code to your theme's functions file, you can then add this line of code to your WordPress header.

/* Mengubah Jumlah Link Sitemap Yoast SEO */function wpgan_sitemap_limit() {    return 500;}
add_filter( 'wpseo_sitemap_entries_per_page', 'wpgan_sitemap_limit' );

For the code above, you can change the number 500 to the number of links you want to display. For example, if you want to display 5,000 links (the maximum number of links you can display on one page is 50,000) on a single page, the code would look like this:

/* Mengubah Jumlah Link Sitemap Yoast SEO */function wpgan_sitemap_limit() {    return 5000;}
add_filter( 'wpseo_sitemap_entries_per_page', 'wpgan_sitemap_limit' );

After the code is saved, you can clear your cache to ensure that all pages are using the latest display and code.

Currently, there is no known way to check what limit has been applied. However, if you still want to verify that the code is actually working, you can set a limit that is lower than your total number of articles.

For example, if you have 750 total posts, you could set a limit of 500, 600, 700, or 749. Since I have 40 pieces of content in the epkb_post_type_1-sitemap.xml sitemap, I will change the maximum to 30, and the result will look like this

Cara Mengubah Jumlah Link Sitemap Yoast SEO

Written by

Muhammad Khoirun Nasikin

I enjoy tinkering with WordPress, hosting, VPS, web development, and various small experiments related to websites. I have over 3 years of experience in the web hosting industry.

COMMENTS

Loading...