hakyll-4.16.0.0: A static website compiler library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hakyll.Web.Meta.OpenGraph

Description

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

og:typeHardcoded value "article"
og:url Required concatenation of root and url context fields, both of which are required.
og:titleRequired 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