diff --git a/_data/diets.yml b/_data/diets.yml new file mode 100644 index 000000000..2deb96f62 --- /dev/null +++ b/_data/diets.yml @@ -0,0 +1,34 @@ +# See https://schema.org/RestrictedDiet#enumbers +DiabeticDiet: + name: diabetic + description: A diet appropriate for people with diabetes. +GlutenFreeDiet: + name: gluten free + description: A diet exclusive of gluten. +HalalDiet: + name: halal + description: A diet conforming to Islamic dietary practices. +HinduDiet: + name: hindu + description: A diet conforming to Hindu dietary practices, in particular, beef-free. +KosherDiet: + name: kosher + description: A diet conforming to Jewish dietary practices. +LowCalorieDiet: + name: low-calorie + description: A diet focused on reduced calorie intake. +LowFatDiet: + name: low-fat + description: A diet focused on reduced fat and cholesterol intake. +LowLactoseDiet: + name: low-lactose + description: A diet appropriate for people with lactose intolerance. +LowSaltDiet: + name: low-salt + description: A diet focused on reduced sodium intake. +VeganDiet: + name: vegan + description: A diet exclusive of all animal products. +VegetarianDiet: + name: vegetarian + description: A diet exclusive of animal meat. diff --git a/_includes/course.html b/_includes/course.html new file mode 100644 index 000000000..c2f171fee --- /dev/null +++ b/_includes/course.html @@ -0,0 +1,12 @@ +{% for course in include.courses %} +{% unless course == empty %} + + + + + + + + +{% endunless %} +{% endfor %} diff --git a/_includes/cuisine.html b/_includes/cuisine.html new file mode 100644 index 000000000..305fe7505 --- /dev/null +++ b/_includes/cuisine.html @@ -0,0 +1,10 @@ +{% if include.cuisines %} +{% for cuisine in include.cuisines %} + + + + + + +{% endfor %} +{% endif %} diff --git a/_includes/diet.html b/_includes/diet.html new file mode 100644 index 000000000..6405efee9 --- /dev/null +++ b/_includes/diet.html @@ -0,0 +1,13 @@ +{% for diet in include.diets %} +{% unless diet == empty %} +{% assign itemprop = diet | append:"Diet" %} +{% assign name = site.data.diets[itemprop].name %} + + + + + + + +{% endunless %} +{% endfor %} diff --git a/_includes/nutritional-information.html b/_includes/nutritional-information.html index 6477cf75f..ff5d4e12c 100644 --- a/_includes/nutritional-information.html +++ b/_includes/nutritional-information.html @@ -6,13 +6,13 @@

Nutritional Information {% endif %}

{% assign nutrients = page.nutrition %} -{% for nutrient in nutrients %} +{% for nutrient in nutrients %} {% if nutrient.first == 'servingSize' %}{% continue %}{% endif %} {% assign itemprop = nutrient.first %} {% assign name = site.data.nutrients[itemprop].name %} {% assign value = nutrient.last %} {% assign unit = site.data.nutrients[itemprop].unit %} -
+
{{ name }}

{{ value }}{{ unit }}

diff --git a/_includes/tag-navigation.html b/_includes/tag-navigation.html new file mode 100644 index 000000000..71f66a131 --- /dev/null +++ b/_includes/tag-navigation.html @@ -0,0 +1,9 @@ +{% assign current = page.url | split:'.' %} +{% assign current = current[0] %} + diff --git a/_includes/tag.html b/_includes/tag.html new file mode 100644 index 000000000..fc371fad5 --- /dev/null +++ b/_includes/tag.html @@ -0,0 +1,12 @@ +{% if include.tags %} + +{% for tag in include.tags %} +
+ + + + +
+{% endfor %} +
+{% endif %} diff --git a/_layouts/recipe.html b/_layouts/recipe.html index 33426a7e0..b609dc90d 100644 --- a/_layouts/recipe.html +++ b/_layouts/recipe.html @@ -29,12 +29,20 @@

{{ page.title }}

-
+
{% include nutritional-information.html %}
+
+
+ {% include cuisine.html cuisines=page.cuisines %} + {% include course.html courses=page.courses %} + {% include diet.html diets=page.diets %} + {% include tag.html tags=page.tags %} +
+
- +
@@ -123,10 +131,6 @@

{{ site.translation[site.language].directions {% endif %} - {% for category in page.categories %} -

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

- {% endfor %} -

diff --git a/courses.html b/courses.html new file mode 100644 index 000000000..728169450 --- /dev/null +++ b/courses.html @@ -0,0 +1,44 @@ +--- +layout: default +--- + +{% assign allTags = "" %} +{% for recipe in site.recipes %} +{% if recipe.courses and recipe.courses != empty %} +{% assign thisTags = recipe.courses | join:'|' | append:'|' %} +{% assign allTags = allTags | append:thisTags %} +{% endif %} +{% endfor %} +{% assign allTags = allTags | split:'|' | sort | uniq %} + +
+
+ {% include tag-navigation.html %} +

Courses

+ {% include course.html courses=allTags %} + +
+ {% unless allTags[0] %} +

No recipes are marked as being for a specific course.

+ {% endunless %} + + {% for course in allTags %} +
+

{{ course }}

+ {% for recipe in site.recipes %} + {% if recipe.courses contains course %} + + {% endif %} + {% endfor %} +
+ {% endfor %} +
+
+
+ + diff --git a/css/main.scss b/css/main.scss index f22d26ed4..ab3152123 100755 --- a/css/main.scss +++ b/css/main.scss @@ -51,3 +51,4 @@ a:hover .image{opacity:0.2;} .border-1 { border-width: 1px; } .border-1:active { border-width: 1px; } .capitalize { text-transform: capitalize; } +.nowrap { white-space: nowrap; } diff --git a/cuisines.html b/cuisines.html new file mode 100644 index 000000000..e89cf251f --- /dev/null +++ b/cuisines.html @@ -0,0 +1,44 @@ +--- +layout: default +--- + +{% assign allTags = "" %} +{% for recipe in site.recipes %} +{% if recipe.cuisines and recipe.cuisines != empty %} +{% assign thisTags = recipe.cuisines | join:'|' | append:'|' %} +{% assign allTags = allTags | append:thisTags %} +{% endif %} +{% endfor %} +{% assign allTags = allTags | split:'|' | sort | uniq %} + +
+
+ {% include tag-navigation.html %} +

Cuisines

+ {% include cuisine.html cuisines=allTags %} + +
+ {% unless allTags[0] %} +

No recipes are marked as being for a specific cuisine.

+ {% endunless %} + + {% for cuisine in allTags %} +
+

{{ cuisine | capitalize }}

+ {% for recipe in site.recipes %} + {% if recipe.cuisines contains cuisine %} + + {% endif %} + {% endfor %} +
+ {% endfor %} +
+
+
+ + diff --git a/diets.html b/diets.html new file mode 100644 index 000000000..9071170c7 --- /dev/null +++ b/diets.html @@ -0,0 +1,46 @@ +--- +layout: default +--- + +{% assign allTags = "" %} +{% for recipe in site.recipes %} +{% if recipe.diets and recipe.diets != empty %} +{% assign thisTags = recipe.diets | join:'|' | append:'|' %} +{% assign allTags = allTags | append:thisTags %} +{% endif %} +{% endfor %} +{% assign allTags = allTags | split:'|' | sort | uniq %} + +
+
+ {% include tag-navigation.html %} +

Diets

+ {% include diet.html diets=allTags %} + +
+ {% unless allTags[0] %} +

No recipes are marked as being for a specific diet.

+ {% endunless %} + + {% for diet in allTags %} +
+ {% assign dietKey = diet | append:"Diet" %} +

{{ site.data.diets[dietKey].name }} +

+ {% for recipe in site.recipes %} + {% if recipe.diets contains diet %} + + {% endif %} + {% endfor %} +
+ {% endfor %} +
+
+
+ + diff --git a/feed.xml b/feed.xml index fa12cfa73..c1bae19cc 100644 --- a/feed.xml +++ b/feed.xml @@ -20,8 +20,8 @@ layout: null {% for tag in post.tags %} {{ tag | xml_escape }} {% endfor %} - {% for cat in post.categories %} - {{ cat | xml_escape }} + {% for course in post.courses %} + {{ course | xml_escape }} {% endfor %} {% endfor %} diff --git a/js/tag-browse.js b/js/tag-browse.js new file mode 100644 index 000000000..01cf0d656 --- /dev/null +++ b/js/tag-browse.js @@ -0,0 +1,16 @@ +$('div[data-tagged]').hide(); + +$('[data-tag-name]').click(function(){ + let tag_name = $(this).data('tag-name'); + $('div[data-tagged]').hide(); + $('[data-tag-name]').removeClass('bg-blue').addClass('bg-gray'); + + let $el = $('div[data-tagged="'+tag_name+'"]'); + $(this).addClass('bg-blue').removeClass('bg-gray'); + $el.show(); +}); + +if (window.location.hash.length > 1) { + let $el = $('[data-tag-name="'+window.location.hash.substring(1)+'"]'); + $el.trigger('click'); +}; diff --git a/search.json b/search.json index ac5b589af..9500297b5 100644 --- a/search.json +++ b/search.json @@ -3,14 +3,16 @@ [ {% for post in site.recipes %} { - + "title" : "{{ post.title | escape }}", {% if post.ingredients %}"ingredients" : "{% for ingredient in post.ingredients %}{{ ingredient | escape }}, {% endfor %}",{% endif %} {% if post.tags %}"tags" : "{% for tag in post.tags %}{{ tag | escape }} {% endfor %}",{% endif %} + {% if post.cuisines %}"cuisines" : "{% for cuisines in post.cuisines %}{{ cuisine | escape }} {% endfor %}",{% endif %} + {% if post.diets %}"diets" : "{% for diet in post.diets %}{{ diet | escape }} {% endfor %}",{% endif %} + {% if post.courses %}"courses" : "{% for course in post.courses %}{{ course | escape }} {% endfor %}",{% endif %} "image" : "{{ site.baseurl }}/images/{{ post.image }}", "url" : "{{ site.baseurl }}{{ post.url }}" - + } {% unless forloop.last %},{% endunless %} {% endfor %} ] - diff --git a/tags.html b/tags.html new file mode 100644 index 000000000..ddbd17cc2 --- /dev/null +++ b/tags.html @@ -0,0 +1,44 @@ +--- +layout: default +--- + +{% assign allTags = "" %} +{% for recipe in site.recipes %} +{% if recipe.tags and recipe.tags != empty %} +{% assign thisTags = recipe.tags | join:'|' | append:'|' %} +{% assign allTags = allTags | append:thisTags %} +{% endif %} +{% endfor %} +{% assign allTags = allTags | split:'|' | sort | uniq %} + +
+
+ {% include tag-navigation.html %} +

Tags

+ {% include tag.html tags=allTags %} + +
+ {% unless allTags[0] %} +

No recipes have any tags yet.

+ {% endunless %} + + {% for tag in allTags %} +
+

{{ tag }}

+ {% for recipe in site.recipes %} + {% if recipe.tags contains tag %} + + {% endif %} + {% endfor %} +
+ {% endfor %} +
+
+
+ +