I reduce Sitemap File Size to Prevent Indexing Update Errors

Roiarthur

Active member
Because my forum have24,00+ urls, the automatic update of my sitemap was not working, i has to recreate a new sitemap every weeks, tired of that situation i found a soultion that is working.

I reduce Sitemap File Size to Prevent Indexing Update Errors

I reduce Sitemap File Size to Prevent Indexing Update Errors

🔦 Introduction

When a XenForo sitemap exceeds 20,000 URLs, indexing issues can occur, especially in Google Search Console. This is often due to the sitemap files being too large. This tutorial explains how to adjust XenForo settings to generate smaller sitemaps and avoid these problems.



🔬 Prerequisites

• Advanced knowledge of Windows

• Proficiency with Windows system tools

Administrator rights required



🪜 Procedure

Step #1 : Identify the current URL limit per sitemap file

Step #2 : Edit MAX_FILE_ENTRIES value in Builder.php

Step #3 : Enable friendly URLs in XenForo

Step #4 : Manually rebuild the sitemap

Step #5 : Verify sitemap submission in Google Search Console



📈 Difficulty Level

Step #1 : Easy

Step #2 : Medium

Step #3 : Easy

Step #4 : Easy

Step #5 : Easy



👍 Advantages

Step #1 : Understand the current sitemap configuration

Step #2 : Reduce sitemap file size for better indexing

Step #3 : Improve sitemap accessibility for search engines

Step #4 : Generate updated sitemaps with the new settings

Step #5 : Ensure proper sitemap submission to Google



👎 Disadvantages

Step #1 : Requires access to XenForo system files

Step #2 : Risk of errors when modifying source code

Step #3 : May require web server reconfiguration

Step #4 : Sitemap generation time depends on site size

Step #5 : Delay before Google processes the new sitemap



⚙️ Step #1 Identify the current URL limit per sitemap file

1️⃣ Access XenForo’s Builder.php file

2️⃣ Open this file:

Code:
src/XF/Sitemap/Builder.php

3️⃣ Look for the MAX_FILE_ENTRIES constant to check the current limit

4️⃣ Note the value defined for this constant



⚙️ Step #2 Edit the MAX_FILE_ENTRIES value in Builder.php

1️⃣ Open Builder.php in a code editor

2️⃣ Find the line containing:

Code:
const MAX_FILE_ENTRIES = 50000;

3️⃣ Change the value to reduce the number of URLs per sitemap file, for example:

Code:
const MAX_FILE_ENTRIES = 10000;

4️⃣ Save and close the file



⚙️ Step #3 Enable friendly URLs in XenForo

1️⃣ Log into the XenForo admin panel

2️⃣ Navigate to: Options > SEO

3️⃣ Enable the "Use Friendly URLs" option

4️⃣ Save the changes



⚙️ Step #4 Manually rebuild the sitemap

1️⃣ In the XenForo admin panel, go to: Tools > Rebuild Caches

2️⃣ Select "Rebuild Sitemap"

3️⃣ Run the rebuild process

4️⃣ Wait for the process to complete so the new sitemap files are generated



⚙️ Step #5 Verify sitemap submission in Google Search Console

1️⃣ Go to Google Search Console

2️⃣ Select your site’s property

3️⃣ Open the "Sitemaps" section

4️⃣ Submit your new sitemap using the URL:
Code:
https://yoursite.com/sitemap.xml

5️⃣ Ensure that Google accepts the sitemap without errors



💡 Tip

For better indexing, consider reducing MAX_FILE_ENTRIES to 5000 or even 1000 depending on your site's size and server performance.

Code:
const MAX_FILE_ENTRIES = 5000;



🚨 Warning

Editing XenForo core files can cause issues during future updates. Document all changes made and reapply them after updates if needed.

Code:
src/XF/Sitemap/Builder.php



🔖 Advice

After adjusting sitemap settings, monitor Google Search Console regularly for indexing errors and adjust parameters as needed.

Code:
https://search.google.com/search-console



💬 Conclusion
By adjusting XenForo to generate smaller sitemaps and enabling friendly URLs, you can improve search engine indexing of your site and prevent issues caused by oversized sitemap files.
 
The modification is not working, the sitemap is not updating automatically, and the new URLs posted this morning are not being included in the sitemap automatically
 
"I checked the update of the new URLs created by the modification in the three XML site maps, and they do not appear. A new sitemap needs to be recreated."
 
The sitemap is rebuilt by cron every few days. You can trigger it manually via the tools in the control panel if you want. The sitemap is already split (not capped) at 50k URLs, which is the official recommendation and we've seen no issues of our own in Search Console.
 
Back
Top Bottom