From b872dbe384ae976fe6abcb0764cab4594fda51eb Mon Sep 17 00:00:00 2001 From: Kathryn Grayson Nanz <61242943+kathryngraysonnanz@users.noreply.github.com> Date: Mon, 24 Aug 2020 13:41:45 -0400 Subject: [PATCH] Add new front matter element: excerpt (#227) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 Co-authored-by: Oscar Co-authored-by: Kathryn <> --- 11ty/_includes/layouts/base.njk | 22 ++++++++++++++++++++- 11ty/definitions/-misia.md | 1 + 11ty/definitions/ableism.md | 1 + 11ty/definitions/barbaric.md | 1 + 11ty/documentation/examples/basic.md | 1 + 11ty/documentation/examples/flagged-word.md | 2 ++ 11ty/documentation/front-matter.md | 14 +++++++++++++ 7 files changed, 41 insertions(+), 1 deletion(-) diff --git a/11ty/_includes/layouts/base.njk b/11ty/_includes/layouts/base.njk index d4d25e52..8bb518d2 100644 --- a/11ty/_includes/layouts/base.njk +++ b/11ty/_includes/layouts/base.njk @@ -9,10 +9,30 @@ {# 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 %} + {{ pageTitle + metadata.title }} + + + + + diff --git a/11ty/definitions/-misia.md b/11ty/definitions/-misia.md index ac9b7e32..c4cc6d74 100644 --- a/11ty/definitions/-misia.md +++ b/11ty/definitions/-misia.md @@ -3,6 +3,7 @@ title: -misia slug: -misia speech: noun defined: true +excerpt: from Greek for hate or hatred sub_terms: - text: Fat full_title: fatmisia diff --git a/11ty/definitions/ableism.md b/11ty/definitions/ableism.md index 833b932d..f4b1a9fb 100644 --- a/11ty/definitions/ableism.md +++ b/11ty/definitions/ableism.md @@ -2,6 +2,7 @@ title: Ableism slug: ableism defined: true +excerpt: a system that places value on people’s 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 flag: level: warning diff --git a/11ty/definitions/barbaric.md b/11ty/definitions/barbaric.md index 66ec255a..e995c035 100644 --- a/11ty/definitions/barbaric.md +++ b/11ty/definitions/barbaric.md @@ -5,6 +5,7 @@ flag: text: 'Neo-Colonial/Racist slur' level: 'avoid' defined: true +excerpt: something which is obscenely cruel; primitive; unsophisticated. speech: adjective reading: - text: 'is the word barbarian a slur?' diff --git a/11ty/documentation/examples/basic.md b/11ty/documentation/examples/basic.md index fa64d7a0..32a48cdf 100644 --- a/11ty/documentation/examples/basic.md +++ b/11ty/documentation/examples/basic.md @@ -13,6 +13,7 @@ title: Example Word slug: 'example-word' speech: noun 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. diff --git a/11ty/documentation/examples/flagged-word.md b/11ty/documentation/examples/flagged-word.md index 378e3141..fe53d379 100644 --- a/11ty/documentation/examples/flagged-word.md +++ b/11ty/documentation/examples/flagged-word.md @@ -21,6 +21,7 @@ flag: text: 'Ableist Slur' level: avoid defined: true +excerpt: mentally deranged; demented; insane. speech: noun alt_words: - abundant @@ -65,6 +66,7 @@ This example is the definition of [performative allyship](/definitions/performat title: performative allyship slug: performative-allyship 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 flag: level: tool diff --git a/11ty/documentation/front-matter.md b/11ty/documentation/front-matter.md index 882cf704..71bcaf9a 100644 --- a/11ty/documentation/front-matter.md +++ b/11ty/documentation/front-matter.md @@ -53,6 +53,20 @@ Whether or not the definition of this word is finished and should be displayed p 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 | Key | Type | required |