From e71b7b6e89e7d39877ab3b2a53c8d4d9f48720b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Brunet?= Date: Sun, 6 Jun 2021 09:44:05 +0200 Subject: [PATCH] Make highlighted tag generic + editable --- src/_includes/layouts/home.njk | 7 ++++--- src/admin/config.yml | 5 +++-- src/index.md | 4 +++- src/scss/components/_home.scss | 6 ++++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/_includes/layouts/home.njk b/src/_includes/layouts/home.njk index 18b4a6e..c138e28 100644 --- a/src/_includes/layouts/home.njk +++ b/src/_includes/layouts/home.njk @@ -18,12 +18,12 @@ bodyClass: c-home - {% if collections["Favourite ⭐"] %} + {% if collections[highlightedTag] %}
-

{{ favouriteRecipes }}

+

{{ highlightedTitle }}

- {% set favouriteRecipes = collections["Favourite ⭐"] | limit(4) %} + {% set favouriteRecipes = collections[highlightedTag] | limit(4) %} {% for recipe in favouriteRecipes %}
{% recipeimage recipe.data.image, "c-card__image", recipe.data.title, "(min-width: 1150px) 25vw, (min-width: 850px) 33vw, (min-width: 550px) 50vw, 100vw" %} @@ -46,6 +46,7 @@ bodyClass: c-home
{% endfor %}
+ {{ highlightedLinkText }}
{% endif %} diff --git a/src/admin/config.yml b/src/admin/config.yml index 2a51936..e9f8e96 100644 --- a/src/admin/config.yml +++ b/src/admin/config.yml @@ -62,8 +62,9 @@ collections: - {label: "Title", name: "title", widget: "string"} - {label: "Add author to title", name: "authorInTitle", widget: "boolean"} - {label: "Meta title", name: "metaTitle", widget: "string", hint: "used for SEO"} - - {label: "Favourite recipes label", name: "favouriteRecipes", widget: "string"} - - {label: "Random recipe label", name: "randomRecipe", widget: "string"} + - {label: "Highlighted tag", name: "highlightedTag", widget: "string", hint: "This must correspond to one of your recipes' tag !"} + - {label: "Title of the highlighted tag section (label)", name: "highlightedTitle", widget: "string"} + - {label: "Link text to all recipes with the highlighted tag (label)", name: "highlightedLinkText", widget: "string"} - name: "recipes" label: "All recipes page" file: "src/recipes.md" diff --git a/src/index.md b/src/index.md index 87b9231..c2e6760 100644 --- a/src/index.md +++ b/src/index.md @@ -3,5 +3,7 @@ layout: layouts/home.njk title: This cookbook belongs to authorInTitle: true metaTitle: Home -favouriteRecipes: Some of my favourite recipes +highlightedTag: Favourite ⭐ +highlightedTitle: Some of my favourite recipes +highlightedLinkText: All my favourite recipes --- \ No newline at end of file diff --git a/src/scss/components/_home.scss b/src/scss/components/_home.scss index 7b6495f..0584f46 100644 --- a/src/scss/components/_home.scss +++ b/src/scss/components/_home.scss @@ -16,4 +16,10 @@ padding: 2px 12px; text-decoration: underline dashed; text-underline-offset: 6px; +} + +.c-home__highlighted-tag-link { + margin-top: 30px; + display: block; + text-align: center; } \ No newline at end of file