Interface SeoTags
-
@ProviderType public interface SeoTags
This model interface gives access to SEO specific information of a page.It can be adapted from any
Page
's content that is of sling:resourceTypewcm/foundation/components/basicpage/v1/basicpage
.Usage:
page.getContentResource().adaptTo(SeoTags.class)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PN_CANONICAL_URL
The property name of the custom canonical url property.static java.lang.String
PN_ROBOTS_TAGS
The property name of the robots tags property.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull java.util.Map<java.util.Locale,java.lang.String>
getAlternateLanguages()
Returns aMap
of alternate language urls of the current Resource.@Nullable java.lang.String
getCanonicalUrl()
Returns the canonical url of the current Resource.@NotNull java.util.List<java.lang.String>
getRobotsTags()
Returns aList
of robots tags to be provided to search engine crawlers.boolean
isCanonical()
Returns true when the current Resource belongs to a canonical page.
-
-
-
Field Detail
-
PN_ROBOTS_TAGS
static final java.lang.String PN_ROBOTS_TAGS
The property name of the robots tags property.- See Also:
- Constant Field Values
-
PN_CANONICAL_URL
static final java.lang.String PN_CANONICAL_URL
The property name of the custom canonical url property.- See Also:
- Constant Field Values
-
-
Method Detail
-
isCanonical
boolean isCanonical()
Returns true when the current Resource belongs to a canonical page. This is the case when the page's canonical url points to itself, meaning when no custom canonical url is set.The default implementation returns true reflecting the assumption that, if not otherwise specified, each page is canonical.
- Returns:
- true when the current resource has no custom canonical url set
-
getCanonicalUrl
@Nullable @Nullable java.lang.String getCanonicalUrl()
Returns the canonical url of the current Resource.This uses the
SitemapLinkExternalizer
implementation to ensure the same canonical url as it is used in Sitemap(s) is returned. The format of the url is complete, meaning it contains authority, path and extension.This may return
null
when the externalization fails.- Returns:
- The canonical, absolute url of the current page.
-
getAlternateLanguages
@NotNull @NotNull java.util.Map<java.util.Locale,java.lang.String> getAlternateLanguages()
Returns aMap
of alternate language urls of the current Resource.An alternate language link exists for each language copy of the
Page
, when thePage
is included in a Sitemap. It uses theSitemapLinkExternalizer
to ensure the same canonical urls as in Sitemap(s) are returned. The format of the url is complete, meaning it contains authority, path and extension.- Returns:
- The canonical, absolute urls of all alternate language versions of the current page.
-
getRobotsTags
@NotNull @NotNull java.util.List<java.lang.String> getRobotsTags()
Returns aList
of robots tags to be provided to search engine crawlers.The collection is curated and may only return tags that are allowed to appear together.
- Returns:
- the curated
List
of robots tags
-
-