feat: created recipes structure
This commit is contained in:
parent
a035c08249
commit
f93207b4e3
7 changed files with 432 additions and 13 deletions
55
_includes/recipe.njk
Normal file
55
_includes/recipe.njk
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
layout: base.njk
|
||||
---
|
||||
<article class="recipe">
|
||||
<header class="recipe-header">
|
||||
<h1>{{ title }}</h1>
|
||||
{% if isDraft %}
|
||||
<span class="draft-badge">Draft</span>
|
||||
{% endif %}
|
||||
<p class="recipe-version">Version {{ recipeVersion }}</p>
|
||||
</header>
|
||||
|
||||
<div class="recipe-content">
|
||||
{{ content | safe }}
|
||||
</div>
|
||||
|
||||
{% set recipeTags = page.inputPath | extractTagsFromFile %}
|
||||
|
||||
{% if recipeTags.length > 0 %}
|
||||
<section class="recipe-tags">
|
||||
<h2>Tags</h2>
|
||||
<ul class="tag-list">
|
||||
{% for tag in recipeTags %}
|
||||
<li><a href="/tags/{{ tag | lower }}/">#{{ tag }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endif %}
|
||||
|
||||
{% if not isDraft and isNewestVersion %}
|
||||
<p class="recipe-permalink">
|
||||
Permalink: <a href="/recipe/{{ recipeSlug }}/">/recipe/{{ recipeSlug }}/</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% set recipeData = collections.recipesBySlug[recipeSlug] %}
|
||||
{% set nonDraftVersions = [] %}
|
||||
{% for version in recipeData.versions %}
|
||||
{% if not version.data.isDraft %}
|
||||
{% set nonDraftVersions = (nonDraftVersions.push(version), nonDraftVersions) %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if nonDraftVersions.length > 1 %}
|
||||
<aside class="recipe-other-versions">
|
||||
<p>Other versions:
|
||||
{% for version in nonDraftVersions %}
|
||||
{% if version.url != page.url %}
|
||||
<a href="{{ version.url }}">v{{ version.data.recipeVersion }}</a>{% if not loop.last %}, {% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</p>
|
||||
</aside>
|
||||
{% endif %}
|
||||
</article>
|
||||
Loading…
Add table
Add a link
Reference in a new issue