format time as 'x hours, y minutes' instead of just 'page.time'
This commit is contained in:
parent
b527bbf48e
commit
2a631e46fd
1 changed files with 15 additions and 1 deletions
|
@ -14,7 +14,21 @@ layout: default
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
|
||||||
<h1>{{ page.name }}</h1>
|
<h1>{{ page.name }}</h1>
|
||||||
<p class='subtle'> {{ page.method.size }} steps - Estimated cooking time: {{ page.time | default: "Not provided" }} {% if page.author %} - By {{ page.author }} {% endif %}</p>
|
{%- if page.time -%}
|
||||||
|
{%- if page.time > 59 %}
|
||||||
|
{%- assign hours = page.time | divided_by: 60 -%}
|
||||||
|
{%- assign minutes = page.time | modulo: 60 -%}
|
||||||
|
{%- assign time = hours | append: " hour" -%}
|
||||||
|
{%- if hours > 1 %}{% assign time = time | append: "s" %}{% endif -%}
|
||||||
|
{%- if minutes > 0 -%}
|
||||||
|
{%- assign time = time | append: " " | append: minutes | append: " minute" -%}
|
||||||
|
{%- if minutes > 1 %}{% assign time = time | append: "s" %}{% endif -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- else -%}
|
||||||
|
{%- assign time = page.time %}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endif -%}
|
||||||
|
<p class='subtle'> {{ page.method.size }} steps - Estimated cooking time: {{ time | default: "Not provided" }} {% if page.author %} - By {{ page.author }} {% endif %}</p>
|
||||||
{%- if applicable_subrecipes %}
|
{%- if applicable_subrecipes %}
|
||||||
<h2> Subrecipes </h2>
|
<h2> Subrecipes </h2>
|
||||||
{% for subrecipe in site.subrecipes -%}
|
{% for subrecipe in site.subrecipes -%}
|
||||||
|
|
Loading…
Reference in a new issue