codepapu

Liferay DXP · SEO module · 2 min

OSGi Struts action on /portal/sitemap that returns sitemap.org XML for a layout set.

Liferay DXP · OSGi · Java · SEO

View on GitHub

Architecture

From the real repo — how the pieces fit.

SEO Sitemap

Struts action on /portal/sitemap → sitemap.org 0.9 XML

GET /portal/sitemap

Optional groupId · privateLayout

Resolve layout set

  1. Query groupId + privateLayout
  2. Else virtual host → layout set
  3. Else guest public pages

Filter layouts

Skip hidden · system · unpublished

<?xml version="1.0"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://…/page</loc>
    <lastmod>ISO date</lastmod>
    <changefreq>daily</changefreq>
    <priority>0.5–1.0</priority>
  </url>
  <!-- …more urls… -->
</urlset>

// 200  text/xml
Request hits the OSGi action; eligible layouts become a urlset tree.

An OSGi module that serves a sitemap.org 0.9 XML document for a Liferay layout set on the portal sitemap path.

What it is

Registers a Struts action on /portal/sitemap (high service ranking) and returns UTF-8 text/xml. Built for DXP (workspace example: dxp-2026.q1.5-lts). Source: codepapu/seo-sitemap.

Which site

  • Optional query groupId and privateLayout.
  • Else match the HTTP Host to a virtual host layout set.
  • Else the guest site's public pages.

Missing or inactive groups return 404.

Which pages

Published, non-hidden, non-system layouts with a friendly URL. Each entry has loc, lastmod, changefreq daily, and priority 1.0 (root) or 0.8.