recipe-site/index.html

62 lines
1.9 KiB
HTML

---
title: Home
layout: default
---
{%- if site.recipes.size > 1 %}
<h2 class='no-bg'>Recipes</h2>
<p class='subtle'>Showing {% if site.recipes_per_page > site.recipes.size %}{{ site.recipes_per_page}}{% else %}{{ site.recipes.size }}{% endif %} results.</p>
{% include recipes.html %}
<h2 class='no-bg'>Stats</h2>
{%- assign steps_total = 0 -%}
{%- assign longest_recipe = site.recipes | first -%}
{%- assign most_ingredients = site.recipes | first -%}
{%- for recipe in site.recipes -%}
{%- assign steps_total = steps_total | plus: recipe.method.size -%}
{%- if recipe.method.size > longest_recipe.method.size -%}
{%- assign longest_recipe = recipe -%}
{%- endif -%}
{%- if recipe.ingredients.size > most_ingredients.ingredients.size -%}
{%- assign most_ingredients = recipe -%}
{%- endif -%}
{%- endfor -%}
{%- assign recipes_size_float = site.recipes.size | times: 1.0 -%}
<table>
<tr>
<td>Recipes</td>
<td>{{ site.recipes.size }}</td>
</tr>
<tr>
<td>Subrecipes</td>
<td>{{ site.subrecipes.size }}</td>
</tr>
<tr>
<td>Authors</td>
<td>{{ site.recipes | map: "author" | uniq | size }}</td>
</tr>
<tr>
<td>Average recipe steps</td>
<td>{{ steps_total | divided_by: recipes_size_float | round: 1 | replace: '.0', '' -}}</td>
</tr>
<tr>
<td>Most ingredients (excluding subrecipes)</td>
<td><a class='dark' href='{{ most_ingredients.url }}'>{{ most_ingredients.name }}</a> ({{ most_ingredients.ingredients.size }} ingredients)</td>
</tr>
<tr>
<td>Most steps (excluding subrecipes)</td>
<td><a class='dark' href='{{ longest_recipe.url }}'>{{ longest_recipe.name }}</a> ({{ longest_recipe.method.size }} steps)</td>
</tr>
</table>
{%- else -%}
{%- comment -%} 0 recipes {%- endcomment -%}
<h2>No recipes</h2>
<p>
No recipes found. Ensure that there is at least one recipe file in the <tt>_recipes</tt> directory. See <a class='dark' href='/help.html'>the help page</a> for more information.
</p>
{% endif %}