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:resourceType wcm/foundation/components/basicpage/v1/basicpage.

    Usage:

    page.getContentResource().adaptTo(SeoTags.class)
    • Field Detail

      • PN_CANONICAL_URL

        static final 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 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 Map<Locale,​String> getAlternateLanguages()
        Returns a Map of alternate language urls of the current Resource.

        An alternate language link exists for each language copy of the Page, when the Page is included in a Sitemap. It uses the SitemapLinkExternalizer 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 List<String> getRobotsTags()
        Returns a List 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