From c41dc6763ca9fc1d53b64fb1138ea75685719098 Mon Sep 17 00:00:00 2001 From: Oscar Date: Tue, 12 Nov 2019 01:17:50 +0100 Subject: [PATCH] feat(11ty): abstract defintions list into own components --- 11ty/_includes/components/definition.njk | 13 +++++++++++++ 11ty/_includes/components/defintions-list.njk | 3 +++ 11ty/_includes/layouts/base.njk | 18 ++---------------- 3 files changed, 18 insertions(+), 16 deletions(-) create mode 100644 11ty/_includes/components/definition.njk create mode 100644 11ty/_includes/components/defintions-list.njk diff --git a/11ty/_includes/components/definition.njk b/11ty/_includes/components/definition.njk new file mode 100644 index 00000000..5a481d0f --- /dev/null +++ b/11ty/_includes/components/definition.njk @@ -0,0 +1,13 @@ +
+

{{ definition.data.title}}

+

{{ definition.data.flag }}

+ {#

{{ definition.data.alt_words }}

#} + {%- if definition.data.alt_words -%} +

Alt words

+ + {% endif %} +
diff --git a/11ty/_includes/components/defintions-list.njk b/11ty/_includes/components/defintions-list.njk new file mode 100644 index 00000000..95c2b5a3 --- /dev/null +++ b/11ty/_includes/components/defintions-list.njk @@ -0,0 +1,3 @@ +{% for definition in collections.definedDefinitions %} + {% include 'components/definition.njk' %} +{% endfor %} diff --git a/11ty/_includes/layouts/base.njk b/11ty/_includes/layouts/base.njk index 13cec135..8c0e1305 100644 --- a/11ty/_includes/layouts/base.njk +++ b/11ty/_includes/layouts/base.njk @@ -34,21 +34,7 @@

Words

- {% for definition in collections.definitions %} -
-

{{ definition.data.title}}

-

{{ definition.data.flag }}

- {#

{{ definition.data.alt_words }}

#} - {%- if definition.data.alt_words -%} -

Alt words

-
    - {% for word in definition.data.alt_words %} -
  • {{ word }}
  • - {% endfor %} -
- {% endif %} -
- {% endfor %} + {% include 'components/defintions-list.njk' %}
- \ No newline at end of file +