volpe/index.njk

71 lines
No EOL
2 KiB
Text

---
layout: base.njk
title: Blog
description: Welcome to my website! I write about tech, politics, food, and hobby projects. Stay a while, make some friends, learn something, and help your neighbors.
---
<section class="intro">
<p>{{ description }}</p>
</section>
{% if collections.posts.length > 0 %}
<div class="section-header">
<h1>Blog Posts</h1>
{% if collections.posts.length > 3 %}
<a href="/posts/" class="view-all">view all</a>
{% endif %}
</div>
<ul class="post-list">
{% for post in collections.posts %}
{% if loop.index0 < 3 %}
<li>
<a href="{{ post.url }}" class="post-card">
<h2>{{ post.data.title }}</h2>
<time datetime="{{ post.data.createdAt | dateTimeFormat }}">{{ post.data.createdAt | dateTimeFormat }}</time>
{% if post.data.description %}
<p>{{ post.data.description }}</p>
{% endif %}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}
{% set recipesList = [] %}
{% for slug, recipeData in collections.recipesBySlug %}
{% if recipeData.newest %}
{% set recipesList = recipesList.concat([{slug: slug, data: recipeData}]) %}
{% endif %}
{% endfor %}
{% if recipesList.length > 0 %}
<div class="section-header">
<h1>Recipes</h1>
{% if recipesList.length > 3 %}
<a href="/recipes/" class="view-all">view all</a>
{% endif %}
</div>
<ul class="post-list">
{% for recipe in recipesList %}
{% if loop.index0 < 3 %}
<li>
<a href="/recipe/{{ recipe.slug }}/" class="post-card">
<h2>{{ recipe.data.newest.data.title }}</h2>
{% if recipe.data.newest.data.description %}
<p>{{ recipe.data.newest.data.description }}</p>
{% endif %}
{% if recipe.data.newest.data.amount %}
<p class="recipe-amount">Amount: {{ recipe.data.newest.data.amount }}</p>
{% endif %}
{% if recipe.data.newest.data.cookingTime %}
<p class="recipe-cooking-time">Cooking Time: {{ recipe.data.newest.data.cookingTime }}</p>
{% endif %}
</a>
</li>
{% endif %}
{% endfor %}
</ul>
{% endif %}