feat: created recipes structure
This commit is contained in:
parent
a035c08249
commit
f93207b4e3
7 changed files with 432 additions and 13 deletions
28
index.njk
28
index.njk
|
|
@ -8,6 +8,7 @@ description: Welcome to my website! I write about tech, politics, food, and hobb
|
|||
<p>{{ description }}</p>
|
||||
</section>
|
||||
|
||||
{% if collections.posts.length > 0 %}
|
||||
<h1>Blog Posts</h1>
|
||||
|
||||
<ul class="post-list">
|
||||
|
|
@ -23,7 +24,30 @@ description: Welcome to my website! I write about tech, politics, food, and hobb
|
|||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if collections.posts.length == 0 %}
|
||||
<p>No blog posts yet.</p>
|
||||
{% set hasRecipes = false %}
|
||||
{% for slug, recipeData in collections.recipesBySlug %}
|
||||
{% if recipeData.newest %}
|
||||
{% set hasRecipes = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if hasRecipes %}
|
||||
<h1>Recipes</h1>
|
||||
|
||||
<ul class="post-list">
|
||||
{% for slug, recipeData in collections.recipesBySlug %}
|
||||
{% if recipeData.newest %}
|
||||
<li>
|
||||
<a href="/recipe/{{ slug }}/" class="post-card">
|
||||
<h2>{{ recipeData.newest.data.title }}</h2>
|
||||
{% if recipeData.newest.data.description %}
|
||||
<p>{{ recipeData.newest.data.description }}</p>
|
||||
{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue