Add new front matter element: excerpt (#227)

* This commit adds the excerpt front matter element, to show an
abbreviated version of the definition in social previews. This
also includes the documentation updates to support this change.

* This commit adds @olvb's suggestion to use 'set' to define the
alert & preview combo, to avoid repetitive code

* This commit updates the preview text to only include the flag if
it's "avoid" – if the flag is "warning" or there is no flag, it
will not appear at the beginning of the preview text.

Co-authored-by: Kathryn Grayson Nanz <kathryn@Kathryns-MacBook-Air.local>
Co-authored-by: Oscar <ovlb@users.noreply.github.com>
Co-authored-by: Kathryn <>
This commit is contained in:
Kathryn Grayson Nanz
2020-08-24 13:41:45 -04:00
committed by GitHub
parent 3808d4d80c
commit b872dbe384
7 changed files with 41 additions and 1 deletions

View File

@ -9,10 +9,30 @@
<link rel="dns-prefetch" href="https://p.typekit.net/">
{# Use title with path, or append a space to the page title to avoid collpasing with the meta title #}
{% set pageTitle = titleWithPath or title + ' ' or '' %}
{% if flag.level == "avoid" %}
{% set alert = flag.level + ": " %}
{% else %}
{% set alert = '' %}
{% endif %}
{% set preview = excerpt or renderData.description or description or metadata.description %}
{% set fullExcerpt = alert + preview %}
<title>{{ pageTitle + metadata.title }}</title>
<meta
name="twitter:description"
content="{{ fullExcerpt }}"
>
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="{{ pageTitle }}"/>
<meta
name="og:description"
content="{{ fullExcerpt }}"
>
<meta name="og:title" content="{{ pageTitle }}"/>
<meta
name="description"
content="{{ renderData.description or description or metadata.description }}"
content="{{ fullExcerpt }}"
>
<link rel="stylesheet" href="https://use.typekit.net/qlo3dpu.css">
<link rel="stylesheet" href="{{ '/assets/css/base.css' | url }}">