hakyll-4.15.0.1: A static website compiler library
Safe HaskellNone
LanguageHaskell2010

Hakyll.Web.Meta.JSONLD

Description

JSON-LD metadata, using Schema.org vocabulary for articles. Google applications and other search engines use these data to improve search results and links.

This implementation supports the following fields:

@typeHardcoded value "Article".
headlineRequired taken from context field title.
datePublishedRequired date of publication, via dateField.

To use, add a jsonldField to your template context:

let
  context = defaultContext <> …
  postContext =
    context
    <> jsonldField "jsonld" context

And update the template:

<head>
  <title>$title$</title>
  <link rel="stylesheet" type="text/css" href="/css/default.css" />
  $if(jsonld)$$jsonld("embed")$$endif$
</head>

The "embed" argument generates a <script …> tag to be directly included in page HTML. To get the raw JSON string, use "raw" instead.

Documentation