@ProviderType
public final class SitemapUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static @NotNull java.util.Iterator<Resource> |
findSitemapRoots(ResourceResolver resolver,
java.lang.String searchPath)
Returns all sitemap root
Resource s within the given search path, excluding the search path itself even if it is a sitemap
root. |
static @NotNull java.lang.String |
getSitemapSelector(@NotNull Resource sitemapRoot,
@NotNull Resource topLevelSitemapRoot,
@NotNull java.lang.String name)
Returns the selector for the given sitemap root
Resource and the given name. |
static @NotNull Resource |
getTopLevelSitemapRoot(@NotNull Resource sitemapRoot)
|
static boolean |
isSitemapRoot(@Nullable Resource resource)
Returns true when the given
Resource is a sitemap root. |
static boolean |
isTopLevelSitemapRoot(@Nullable Resource resource)
Returns true when the given
Resource is a top level sitemap root. |
static @Nullable Resource |
normalizeSitemapRoot(@Nullable Resource resource)
|
static @NotNull java.util.Map<Resource,java.lang.String> |
resolveSitemapRoots(@NotNull Resource topLevelSitemapRoot,
@NotNull java.lang.String sitemapSelector)
|
@NotNull public static @NotNull Resource getTopLevelSitemapRoot(@NotNull @NotNull Resource sitemapRoot)
Resource
marked as sitemap root that is closest to the repository root starting with the
given Resource
.sitemapRoot
- @Nullable public static @Nullable Resource normalizeSitemapRoot(@Nullable @Nullable Resource resource)
resource
- public static boolean isSitemapRoot(@Nullable @Nullable Resource resource)
Resource
is a sitemap root.resource
- public static boolean isTopLevelSitemapRoot(@Nullable @Nullable Resource resource)
Resource
is a top level sitemap root.resource
- @NotNull public static @NotNull java.lang.String getSitemapSelector(@NotNull @NotNull Resource sitemapRoot, @NotNull @NotNull Resource topLevelSitemapRoot, @NotNull @NotNull java.lang.String name)
Resource
and the given name.sitemapRoot
- topLevelSitemapRoot
- name
- @NotNull public static @NotNull java.util.Map<Resource,java.lang.String> resolveSitemapRoots(@NotNull @NotNull Resource topLevelSitemapRoot, @NotNull @NotNull java.lang.String sitemapSelector)
Resource
s for the given selector within the given top level sitemap root
Resource
. This is the inversion of getSitemapSelector(Resource, Resource, String)
with
sitemap root being a top level sitemap root.
The returned Map
only contains Resource
s, that are sitemap roots according to
isSitemapRoot(Resource)
. Each returned Resource
is mapped to the name which when
passed to getSitemapSelector(Resource, Resource, String)
would return the same selector,
omitting the optional multi-file index part.
As this resolution may be ambiguous, the returned Map
is sorted with the sitemap root/name combinations
closest to the top level sitemap root taking precedence.
topLevelSitemapRoot
- sitemapSelector
- Map
@NotNull public static @NotNull java.util.Iterator<Resource> findSitemapRoots(ResourceResolver resolver, java.lang.String searchPath)
Resource
s within the given search path, excluding the search path itself even if it is a sitemap
root.
The Resource
s returned are normalized using normalizeSitemapRoot(Resource)
.
resolver
- searchPath
- Copyright © 2010 - 2023 Adobe. All Rights Reserved