From 7afa809e4b19c327ad14a4cff3f41b21f02344e2 Mon Sep 17 00:00:00 2001 From: Rue Turner Date: Fri, 1 May 2020 08:23:48 +0100 Subject: [PATCH 1/4] book feature --- _data/people.yml | 8 +++++++ _includes/book-preview.html | 28 ++++++++++++++++++++++++ _includes/recipe-preview.html | 7 ++++++ _includes/related-books.html | 12 +++++++++++ _layouts/book.html | 40 +++++++++++++++++++++++++++++++++++ _layouts/recipe.html | 1 + books.html | 16 ++++++++++++++ 7 files changed, 112 insertions(+) create mode 100644 _data/people.yml create mode 100644 _includes/book-preview.html create mode 100644 _includes/recipe-preview.html create mode 100644 _includes/related-books.html create mode 100644 _layouts/book.html create mode 100644 books.html diff --git a/_data/people.yml b/_data/people.yml new file mode 100644 index 000000000..baf2b9b1b --- /dev/null +++ b/_data/people.yml @@ -0,0 +1,8 @@ +# Store your people here +# eg: +# +# clarklab: +# name: Clark Wimberly +# twitter: @clarklab +# web: http://clarklab.com +# diff --git a/_includes/book-preview.html b/_includes/book-preview.html new file mode 100644 index 000000000..978c87d78 --- /dev/null +++ b/_includes/book-preview.html @@ -0,0 +1,28 @@ +{% assign thisbook = include.book %} +
+ + + +
+ +
+ +
+
+

{{ thisbook.title }}

+ {% if thisbook.author %} + {% assign author = site.data.people[thisbook.author] %} +

by {{ author.name }}

+ {% endif %} +

{{ thisbook.description }}

+

+ {{ thisbook.covernotes }} +

+ + {% unless page.url == thisbook.url %} + Read on... + {% endunless %} +
+
+ +
diff --git a/_includes/recipe-preview.html b/_includes/recipe-preview.html new file mode 100644 index 000000000..acf5a993b --- /dev/null +++ b/_includes/recipe-preview.html @@ -0,0 +1,7 @@ +{% assign thisrecipe = include.recipe %} + + + {{ thisrecipe.title }} + + +{% assign thisrecipe = nil %} diff --git a/_includes/related-books.html b/_includes/related-books.html new file mode 100644 index 000000000..ac8b83cff --- /dev/null +++ b/_includes/related-books.html @@ -0,0 +1,12 @@ +{% assign booklist = site.books | where: 'id', page.books %} + +{% if booklist.first %} + +{% endif %} diff --git a/_layouts/book.html b/_layouts/book.html new file mode 100644 index 000000000..dab7c7e38 --- /dev/null +++ b/_layouts/book.html @@ -0,0 +1,40 @@ +--- +layout: default +--- + +
+
+ {{ content }} +
+ + + + +
diff --git a/_layouts/recipe.html b/_layouts/recipe.html index 33426a7e0..6a2665156 100644 --- a/_layouts/recipe.html +++ b/_layouts/recipe.html @@ -127,6 +127,7 @@

{{ site.translation[site.language].directions

{{ site.translation[site.language].category }}: {{ category }}

{% endfor %} + {% include related-books.html %} diff --git a/books.html b/books.html new file mode 100644 index 000000000..828a6d048 --- /dev/null +++ b/books.html @@ -0,0 +1,16 @@ +--- +layout: default +--- + +
+ +

Books

+

Here's all the lovely books we have.

+ +
+ {% for book in site.books %} + {% include book-preview.html book=book %} + {% endfor %} +
+ +
From 2d14a2aff2a761857b727d20b431fba8eb4a5f09 Mon Sep 17 00:00:00 2001 From: Rue Turner Date: Fri, 1 May 2020 08:54:36 +0100 Subject: [PATCH 2/4] cleanup assignments --- _includes/book-preview.html | 4 ++++ _includes/related-books.html | 2 ++ _layouts/book.html | 6 +++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/_includes/book-preview.html b/_includes/book-preview.html index 978c87d78..c3e2c32da 100644 --- a/_includes/book-preview.html +++ b/_includes/book-preview.html @@ -1,4 +1,5 @@ {% assign thisbook = include.book %} +
@@ -26,3 +27,6 @@

by {{ author.name }}

+ +{% assign author = nil %} +{% assign thisbook = nil %} diff --git a/_includes/related-books.html b/_includes/related-books.html index ac8b83cff..f281c505f 100644 --- a/_includes/related-books.html +++ b/_includes/related-books.html @@ -10,3 +10,5 @@ {% endfor %} {% endif %} + +{% assign booklist = nil %} diff --git a/_layouts/book.html b/_layouts/book.html index dab7c7e38..8977ca8d3 100644 --- a/_layouts/book.html +++ b/_layouts/book.html @@ -1,6 +1,7 @@ --- layout: default --- +{% assign pageAuthor = site.data.people[page.author] %}
@@ -24,9 +25,8 @@