Listing URL-s from Sitemap.xml
knowledge-article-header-disclaimer-how-to
knowledge-article-header-disclaimer
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