legacy-knowledge-base
公開されました Jun. 30, 2025

Listing URL-s from Sitemap.xml

written-by

Peter Nyiro

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

learn-legacy-article-disclaimer-text

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