Legacy Knowledge Base
Published Jun. 30, 2025

Sitemap exceeds 50000 limit

Written By

Anushka Tiwari

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • Sitemap should not generate with more than 50,000 entries or 50 MB in size (this is Google standard). 
  • Steps to reproduce:
  1. Run the following Groovy script:
    def company = com.liferay.portal.kernel.util.PortalUtil.getCompany(actionRequest);
    long companyId = company.getCompanyId();

    def user = com.liferay.portal.kernel.util.PortalUtil.getUser(actionRequest);
    long userId = user.getUserId();

    def guestGroup = com.liferay.portal.kernel.service.GroupLocalServiceUtil.getGroup(companyId, com.liferay.portal.kernel.model.GroupConstants.GUEST);
    def groupId = guestGroup.getGroupId();

    def type = com.liferay.portal.kernel.model.LayoutConstants.TYPE_PORTLET;

    def serviceContext = new com.liferay.portal.kernel.service.ServiceContext();

    def pagePrefix = "my-layout-";

    for (int i = 1; i <= 50001; i++) {
    def name = pagePrefix + i;
    def title = name;
    def description = name;
    def friendlyURL = "/" + name;
    com.liferay.portal.kernel.service.LayoutLocalServiceUtil.addLayout(userId, groupId, false, com.liferay.portal.kernel.model.LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, name, title, description, type, false, false, friendlyURL, serviceContext);
    }
  2. When finished, download the sitemap.xml file from http://localhost:8080/sitemap.xml.

  3. Executed the shell command:

    grep -o '<loc>' sitemap.xml | wc -l
  4. Check the value obtained by the command executed previously
    Expected behaviour:

    The value is 50,000, and the newest entries are present.
    Actual behaviour:
    The value is 50,002

Environment

  • Liferay DXP 7.1

Resolution

  • The observed behavior is a known bug addressed by the LPSA-55887 and has already been included in 7.1.10.5 SP5 .

Additional Information

Did this article resolve your issue ?

Legacy Knowledge Base