Skip to content

Latest commit

 

History

History
62 lines (55 loc) · 1.69 KB

README.md

File metadata and controls

62 lines (55 loc) · 1.69 KB

Structured data addon for Hippo

This is an hst addon to providing structured data using json-ld.

Usage

  • Add Open Web repository, and structured-data dependency to Hippo Site
<dependency>
  <groupId>nl.openweb.hippo.hst</groupId>
  <artifactId>structured-data</artifactId>
  <version>13.0.X</version>
</dependency>
  • Create mapper classes implementing the interface: nl.openweb.structured.data.schema.mapping.StructuredDataMapper

  • Register them in spring

<bean id="breadcrumbList" class="nl.openweb.structured.data.mapper.BreadCrumbListMapper" />
<bean class="nl.openweb.structured.data.mapper.EventMapper" />
  • Define the tag in your jsp
<%@ taglib prefix="sd" uri="http://open-web.nl/hippo/structured-data"% > 

or freemarker:

<#assign sd=JspTaglibs ["http://open-web.nl/hippo/structured-data"] >

Tags to use for immediate rendering

To map the current contentbean in your jsp

<sd:ldJson />

or freemarker:

<@sd.ldJson /> 

It's also possible to define the object and use a named mapper in your jsp

<sd:ldJson bean="${breadcrumbList}" mapper="breadcrumbList"/>

or freemarker:

<@sd.ldJson bean=breadcrumbList mapper=breadcrumbList/>

Tags for Asynchronous rendering

To use this plugin in an asynchronous matter, as headContributions of hippo, use these tags.
As with the original tag, the bean and mapper attributes are optional.

for JSP:

<sd:ldJsonContribution bean="${bean}" mapper="${myBeanMapper}"/> 
<sd:structuredDataPlaceholder/>

for freemarker:

<@sd.ldJsonContribution bean=bean mapper=myBeanMapper/> 
<@sd.structuredDataPlaceholder/>