The <o:sitemapUrl> is a component which renders the given target URL or Faces view ID as a sitemap
URL with support for adding additional query string parameters to the URL via nested <f:param>
and <o:param>.
This component is largely based off the Url component behind <o:url>, but then tailored
specifically for usage in sitemap.xml file. The ViewResourceHandler must be registered in
faces-config.xml in order to get Faces components to run in /sitemap.xml.
You can supply the sitemap URL via either the value attribute or the viewId attribute. When
both are specified, the value attribute takes precedence and the viewId attribute is ignored.
When the target URL is specified as viewId, then the domain of the target URL defaults to the current
domain. It is possible to provide a full qualified domain name (FQDN) via the domain attribute which
the URL is to be prefixed with. This can be useful if a canonical page shall point to a different domain or a
specific subdomain.
Valid formats and values for domain attribute are:
<o:sitemapUrl ... domain="https://example.com" /><o:sitemapUrl ... domain="//example.com" /><o:sitemapUrl ... domain="example.com" /><o:sitemapUrl ... domain="/" /><o:sitemapUrl ... domain="//" />
The domain value will be validated by URL and throw an illegal argument exception when invalid.
If the domain equals /, then the URL becomes domain-relative.
If the domain equals or starts with //, or does not contain any scheme, then the URL becomes scheme-relative.
If the value attribute is specified, then the domain attribute is ignored.
You can add query string parameters to the URL via nested <f:param> and <o:param>.
To conditionally add or override, use the disabled attribute of <f|o:param>.
Usage example of /sitemap.xml as a Faces view:
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:ui="jakarta.faces.facelets"
xmlns:o="omnifaces"
>
<ui:repeat value="#{sitemapBean.products}" var="product">
<o:sitemapUrl viewId="/product.xhtml" lastModified="#{product.lastModified}" changeFrequency="weekly" priority="1.0">
<o:param name="id" value="#{product}" converter="productConverter" />
</o:sitemapUrl>
</ui:repeat>
</urlset>
| Info | Value |
|---|---|
| Component Type | org.omnifaces.component.output.SitemapUrl |
| Handler Class | None |
| Renderer Type | None |
| Description | None |
| Name | Required | Type | Description |
|---|---|---|---|
binding | false | jakarta.el.ValueExpression
(must evaluate to jakarta.faces.component.UIComponent)
| The ValueExpression linking this component to a property in a backing bean. |
changeFrequency | false | jakarta.el.ValueExpression
(must evaluate to org.omnifaces.component.output.SitemapUrl.ChangeFrequency)
| The value of the "changefreq" element of the sitemap URL. |
domain | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| The domain of the "loc" element of the sitemap URL.
Note: this is ignored when #getValue() is specified. |
id | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| The component identifier for this component. This value must be unique within the closest parent component that is a naming container. |
lastModified | false | jakarta.el.ValueExpression
(must evaluate to java.time.temporal.Temporal)
| The value of the "lastmod" element of the sitemap URL. |
priority | false | jakarta.el.ValueExpression
(must evaluate to java.math.BigDecimal)
| The value of the "priority" element of the sitemap URL. |
rendered | false | jakarta.el.ValueExpression
(must evaluate to boolean)
| Flag indicating whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value for this property is true. |
value | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| The value of the "loc" element of the sitemap URL.
Note: when specified, then #getViewId() and #getDomain() are ignored. |
viewId | false | jakarta.el.ValueExpression
(must evaluate to java.lang.String)
| The view ID to create the URI part of the "loc" element of the sitemap URL for.
Note: this is ignored when #getValue() is specified. |
Output generated by Vdldoc View Declaration Language Documentation Generator.