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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 1 deletions

View File

@ -9,10 +9,30 @@
<link rel="dns-prefetch" href="https://p.typekit.net/"> <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 #} {# 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 '' %} {% 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> <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 <meta
name="description" 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="https://use.typekit.net/qlo3dpu.css">
<link rel="stylesheet" href="{{ '/assets/css/base.css' | url }}"> <link rel="stylesheet" href="{{ '/assets/css/base.css' | url }}">

View File

@ -3,6 +3,7 @@ title: -misia
slug: -misia slug: -misia
speech: noun speech: noun
defined: true defined: true
excerpt: from Greek for hate or hatred
sub_terms: sub_terms:
- text: Fat - text: Fat
full_title: fatmisia full_title: fatmisia

View File

@ -2,6 +2,7 @@
title: Ableism title: Ableism
slug: ableism slug: ableism
defined: true defined: true
excerpt: a system that places value on peoples bodies and minds based on societally constructed ideas of normalcy, intelligence, excellence, and productivity. These constructed ideas are deeply rooted in anti-Blackness, eugenics, colonialism, and capitalism.
speech: noun speech: noun
flag: flag:
level: warning level: warning

View File

@ -5,6 +5,7 @@ flag:
text: 'Neo-Colonial/Racist slur' text: 'Neo-Colonial/Racist slur'
level: 'avoid' level: 'avoid'
defined: true defined: true
excerpt: something which is obscenely cruel; primitive; unsophisticated.
speech: adjective speech: adjective
reading: reading:
- text: 'is the word barbarian a slur?' - text: 'is the word barbarian a slur?'

View File

@ -13,6 +13,7 @@ title: Example Word
slug: 'example-word' slug: 'example-word'
speech: noun speech: noun
defined: true defined: true
excerpt: This is a definition.
--- ---
This is a sentence. It describes a word. This definition is written in Markdown. So you can do stuff. [Including links](/link), for example. This is a sentence. It describes a word. This definition is written in Markdown. So you can do stuff. [Including links](/link), for example.

View File

@ -21,6 +21,7 @@ flag:
text: 'Ableist Slur' text: 'Ableist Slur'
level: avoid level: avoid
defined: true defined: true
excerpt: mentally deranged; demented; insane.
speech: noun speech: noun
alt_words: alt_words:
- abundant - abundant
@ -65,6 +66,7 @@ This example is the definition of [performative allyship](/definitions/performat
title: performative allyship title: performative allyship
slug: performative-allyship slug: performative-allyship
defined: true defined: true
excerpt: when an individual or group of power/majority/privilege loudly profess(es) their actions in the name of 'allyship,' while actively conducting harm to the group they claim to support
speech: noun speech: noun
flag: flag:
level: tool level: tool

View File

@ -53,6 +53,20 @@ Whether or not the definition of this word is finished and should be displayed p
defined: true defined: true
``` ```
## Excerpt
| Key | Type | required |
| ------- | ------- | -------- |
| excerpt | String | true |
An abbreviated version of the definition that will appear in social media previews. In the social preview, the excerpt will be prefaced with the flag level.
### Example
```yaml
excerpt: This is the short version of the definition that will appear in social previews.
```
## Speech ## Speech
| Key | Type | required | | Key | Type | required |