hakyll-4.16.2.2: A static website compiler library

Safe Haskell | Safe-Inferred
Language | Haskell2010

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:

`@type` | Hardcoded value `"Article"`.
`headline` | Required taken from context field `title`.
`datePublished` | Required 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

jsonldField :: String -> Context String -> Context String Source #