hakyll-4.16.2.0: A static website compiler library

Safe Haskell | Safe-Inferred
Language | Haskell2010

Hakyll.Web.Meta.OpenGraph

Description

Open Graph metadata, as described at https://ogp.me/. This implementation supports the following properties:

`og:type` | Hardcoded value `"article"`
`og:url` | Required concatenation of `root` and `url` context fields, both of which are required.
`og:title` | Required title of article, from `title` field.
`og:description` | Optional brief description taken from context field `og-description`, if set.
`og:image` | Optional image URL taken from context field `og-image`, if set.

To use, add `openGraphField` to the template context:

    let
      context = defaultContext <> …
      postContext = context <> openGraphField "opengraph" context

and update the template:

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

See also Hakyll.Web.Meta.TwitterCard.

# Documentation

openGraphField :: String -> Context String -> Context String Source #