Legacy Knowledge Base
Published Jun. 30, 2025

Listing URL-s from Sitemap.xml

Written By

Peter Nyiro

How To articles are not official guidelines or officially supporteddocumentation. They are community-contributed content and may not alwaysreflect the latest updates to Liferay DXP. We welcome your feedback toimprove How to articles!

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

Legacy Article

You are viewing an article from our legacy "FastTrack"publication program, made available for informational purposes. Articlesin this program were published without a requirement for independentediting or verification and are provided "as is" withoutguarantee.

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

Issue

  • Does Liferay have any tools or scripts which will allow us to get a list of all the URLs which are included in the full site map?

Additional Information

  • Change the Sitemap format in Liferay DXP: By default, the sitemap is spread across multiple pages for better performance, especially in production environments.
  • Out of the box, there are no tools to generate a list from the sitemap.
  • Configuring XML Sitemaps: You can view your XML sitemap by accessing http://your-site/sitemap.xml

Resolution

  • You can achieve this through its API using Java code. Here's how:
    Leverage LayoutLocalServiceUtil.getLayouts(groupId, privateLayout) method: This retrieves a list of layouts (pages) based on the group ID (of the site) and whether they're private or public.

    Iterate through the retrieved layouts: Use a loop to process each layout obtained in step 1.
    Extract URL from each layout: Within the loop, use the Layout.getFriendlyURL() method to get the user-friendly URL of the specific page (layout).

    This approach involves writing a custom Java program or portlet to interact with Liferay's API.
    For larger sites with many pages, this method might become resource-intensive.
Did this article resolve your issue ?

Legacy Knowledge Base