Class BreadcrumbListJsonLd
- All Implemented Interfaces:
Component
Adds a BreadcrumbsList in JSON-LD format script just before head end. This is not a visual element for the user to navigate by, but is only the script in JSON-LD.
This is applied to all views
and all pages
, even those that are "noindex".
All links within the BreadcrumbList are within the current view and keep the view setting. Thus, different views might have different BreadcrumbLists depending on the applicability of a view to the parent pages.
Generates one BreadcrumbList for each unique path through parent pages. This is done with a depth-first search through the parents DAG, with each leaf node constituting a starting point for a BreadcrumbList.
Parents in missing books are skipped.
All parents are verified as applicable to the given view. The search stops when there are no parents applicable to the given view. The parent's parents will not be checked in this case.
Parents are always handled in-order, so the ordering of the resulting BreadcrumbList is determined by the ordering the parents are declared.
When the first item of the BreadcrumbList is the site's root (contentRoot
of the rootBook
), which will typically be the case, the root
is excluded from the list.
With the above constraints, should two paths be found to be duplicates, only the first is added.
The current page is always included in the BreadcrumbList, unless it is the contentRoot itself.
shortTitle
is used for each list entry, with the parent
in the list as the shortTitle context. This was the original motivation for making shortTitle
be configurable on a per-parent basis. When the site root is excluded from the BreadcrumbList,
it is still used as the parent context for shortTitle.
See PageUtils.getShortTitle(com.semanticcms.core.model.PageRef, com.semanticcms.core.model.Page)
for details.
The URLs contained within breadcrumbLists are generated as absolute URLs, similar to how the sitemaps are generated.
The URLs within BreadcrumbLists are not rewritten by the current site export. A more advanced export in the future may allow for this.
See also:-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Registers theBreadcrumbListJsonLd
component inSemanticCMS
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
doComponent
(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, DocumentEE document, View view, Page page, ComponentPosition position)
-
Method Details
-
doComponent
public void doComponent(ServletContext servletContext, HttpServletRequest request, HttpServletResponse response, DocumentEE document, View view, Page page, ComponentPosition position) throws ServletException, IOException - Specified by:
doComponent
in interfaceComponent
- Throws:
ServletException
IOException
-