Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Info tags #31

Open
wants to merge 17 commits into
base: gh-pages
Choose a base branch
from
Prev Previous commit
Next Next commit
add tag navigation for browsing recipes
improve top links
remove unnecessary logic
  • Loading branch information
rathgar committed Apr 22, 2020
commit d7dd186442caa43d7177b764a868ce2c276fa157
2 changes: 1 addition & 1 deletion _includes/nutritional-information.html
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ <h4 class="blue mt0 mb2 xs-center">Nutritional Information
{% assign name = site.data.nutrients[itemprop].name %}
{% assign value = nutrient.last %}
{% assign unit = site.data.nutrients[itemprop].unit %}
<div class="rounded center border border-1 border-gray sm-col sm-col-2 lg-col-1 mr1 mb1">
<div class="rounded center border border-1 border-gray sm-col sm-col-2 lg-col-2 mr1 mb1">
<h5 class="bg-gray white m0 p1 capitalize">{{ name }}</h5>
<p itemprop="{{ itemprop }}">{{ value }}{{ unit }}</p>
</div>
9 changes: 9 additions & 0 deletions _includes/tag-navigation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% assign current = page.url | split:'.' %}
{% assign current = current[0] %}
<nav class="mt4">
Browse by
<a href="/diets" class="button button-transparent {% if current == '/diets' %}is-active{% endif %}">Diet</a>
<a href="/categories" class="button button-transparent {% if current == '/categories' %}is-active{% endif %}">Category</a>
<a href="/cuisines" class="button button-transparent {% if current == '/cuisines' %}is-active{% endif %}">Cuisine</a>
<a href="/tags" class="button button-transparent {% if current == '/tags' %}is-active{% endif %}">Tag</a>
</nav>
6 changes: 3 additions & 3 deletions categories.html
Original file line number Diff line number Diff line change
@@ -4,29 +4,29 @@

{% assign allTags = "" %}
{% for recipe in site.recipes %}
{% if recipe.categories %}
{% if recipe.categories and recipe.categories != empty %}
{% assign thisTags = recipe.categories | join:'|' | append:'|' %}
{% assign allTags = allTags | append:thisTags %}
{% endif %}
{% endfor %}
{% assign allTags = allTags | split:'|' | sort | uniq %}

<div class="container">
{% include tag-navigation.html %}
<h1>Categories</h1>
{% include category.html categories=allTags %}

<div class="clearfix">
{% for category in allTags %}
{% unless category == "" %}
<div class="sm-col sm-col-6 md-col-6 lg-col-4 xs-px1 xs-mb2">
<h2><a name="{{ category | downcase }}"></a>{{ category | capitalize }}</h2>
<ul>
{% for recipe in site.recipes %}
{% if recipe.categories contains category %}<li><a href="{{ recipe.url }}">{{ recipe.title }}</a></li>{% endif %}
{% endfor %}
</ul>
<a href="#top" class="button button-transparent h6 block">&#8679; top</a>
</div>
{% endunless %}
{% endfor %}
</div>
</div>
6 changes: 3 additions & 3 deletions cuisines.html
Original file line number Diff line number Diff line change
@@ -4,29 +4,29 @@

{% assign allTags = "" %}
{% for recipe in site.recipes %}
{% if recipe.cuisines %}
{% 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 %}

<div class="container">
{% include tag-navigation.html %}
<h1>Cuisines</h1>
{% include cuisine.html cuisines=allTags %}

<div class="clearfix">
{% for cuisine in allTags %}
{% unless cuisine == "" %}
<div class="sm-col sm-col-6 md-col-6 lg-col-4 xs-px1 xs-mb2">
<h2><a name="{{ cuisine | downcase }}"></a>{{ cuisine | capitalize }}</h2>
<ul>
{% for recipe in site.recipes %}
{% if recipe.cuisines contains cuisine %}<li><a href="{{ recipe.url }}">{{ recipe.title }}</a></li>{% endif %}
{% endfor %}
</ul>
<a href="#top" class="button button-transparent h6 block">&#8679; top</a>
</div>
{% endunless %}
{% endfor %}
</div>
</div>
6 changes: 3 additions & 3 deletions diets.html
Original file line number Diff line number Diff line change
@@ -4,20 +4,20 @@

{% assign allTags = "" %}
{% for recipe in site.recipes %}
{% if recipe.diets %}
{% 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 %}

<div class="container">
{% include tag-navigation.html %}
<h1>Diets</h1>
{% include diet.html diets=allTags %}

<div class="clearfix">
{% for diet in allTags %}
{% unless diet == blank %}
<div class="sm-col sm-col-6 md-col-6 lg-col-4 xs-px1 xs-mb2">
{% assign dietKey = diet | append:"Diet" %}
<h2><a name="{{ diet | downcase }}"></a>{{ diet | capitalize }}
@@ -27,8 +27,8 @@ <h2><a name="{{ diet | downcase }}"></a>{{ diet | capitalize }}
{% if recipe.diets contains diet %}<li><a href="{{ recipe.url }}">{{ recipe.title }}</a></li>{% endif %}
{% endfor %}
</ul>
<a href="#top" class="button button-transparent h6 block">&#8679; top</a>
</div>
{% endunless %}
{% endfor %}
</div>
</div>
6 changes: 3 additions & 3 deletions tags.html
Original file line number Diff line number Diff line change
@@ -4,29 +4,29 @@

{% assign allTags = "" %}
{% for recipe in site.recipes %}
{% if recipe.tags %}
{% 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 %}

<div class="container">
{% include tag-navigation.html %}
<h1>Tags</h1>
{% include tag.html tags=allTags %}

<div class="clearfix">
{% for tag in allTags %}
{% unless tag == "" %}
<div class="sm-col sm-col-6 md-col-6 lg-col-4 xs-px1 xs-mb2">
<h2><a name="{{ tag | downcase }}"></a>{{ tag | capitalize }}</h2>
<ul>
{% for recipe in site.recipes %}
{% if recipe.tags contains tag %}<li><a href="{{ recipe.url }}">{{ recipe.title }}</a></li>{% endif %}
{% endfor %}
</ul>
<a href="#top" class="button button-transparent h6 block">&#8679; top</a>
</div>
{% endunless %}
{% endfor %}
</div>
</div>