Legacy Knowledge Base
公開されました Jun. 30, 2025

サイトマップが50000を超える

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.

問題

  • サイトマップは、50,000件以上または50MB以上のサイズで生成されるべきではありません(これはGoogleの標準です)。
  • 再現の手順
  1. 以下のGroovyスクリプトを実行する:
    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. 完了したら、http://localhost:8080/sitemap.xml からsitemap.xmlファイルをダウンロードする。

  3. シェルコマンドを実行:

    grep -o '<loc>' sitemap.xml | wc -l
  4. 先に実行されたコマンドによって得られた値をチェックする
    期待される動作:


    実際の動作:
    値は50,002である。

環境

  • Liferay DXP 7.1

解像度

  • 観測された動作は、以下の既知のバグです。 LPSA-55887 によって対処された既知のバグであり 7.1.10.5 SP5に含まれています。

追加情報

Did this article resolve your issue ?

Legacy Knowledge Base