recipe-site/index.html

55 lines
1.7 KiB
HTML
Raw Normal View History

2020-02-29 16:07:24 +00:00
---
title: Home
layout: default
---
<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 %}
{%- if site.recipes.size > 1 %}
<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>
{% endif %}