dustin.web/templates/projects.html

43 lines
1.1 KiB
HTML

{% extends "base.html" %}
{% macro project_card(path, permalink, title, description, image_path) %}
<div class="project-card">
<a href="{{ permalink }}">
{% if image_path is defined %}
{% set image = resize_image(path=image_path, width=640, height=480, op="fit") %}
<img src="{{ image.url }}" />
{% else %}
<img src="//picsum.photos/seed/{{ path | slugify }}/320/240" />
{% endif %}
<h2>{{ title }}</h2>
<p>{{ description }}</p>
</a>
</div>
{% endmacro %}
{% block content %}
<article class="post panel">
<h1 class="post-title">{{ section.title }}</h1>
{{ section.content | safe }}
<div class="project-cards">
{% for path in section.subsections %}
{% set sect = get_section(path=path) %}
{{ self::project_card(
path=path,
permalink=sect.permalink,
title=sect.title,
description=sect.description,
image_path=sect.extra.image,
) }}
{% endfor %}
{% for page in section.pages %}
{{ self::project_card(
path=page.path,
permalink=page.permalink,
title=page.title,
description=page.description,
image_path=page.extra.image,
) }}
{% endfor %}
</div>
</article>
{% endblock %}