w5isp.com/templates/index.html

60 lines
1.7 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ section.title }} - {{ config.title }}{% endblock title %}
{% block content %}
<section>
{% if section.title %}
<h1>{{ section.title }}</h1>
{% endif %}
<div>
{{ section.content | safe }}
</div>
</section>
{% set projects_section = get_section(path="projects/_index.md") %}
{% if projects_section.pages | length > 0 %}
<h2>Projects</h2>
<ul>
{% for page in projects_section.pages %}
<li>
<a href="{{ page.extra.url }}">{{ page.title }}</a> — {{ page.description }}
</li>
{% endfor %}
</ul>
{% endif %}
{% set blog_section = get_section(path="blog/_index.md") %}
{% if blog_section.pages | length > 0 %}
<h2>Blog</h2>
{% set latest = blog_section.pages | first %}
<article>
<h2><a href="{{ latest.permalink }}">{{ latest.title }}</a></h2>
{% if latest.date %}
<p><time datetime="{{ latest.date | date(format="%Y-%m-%d") }}">{{ latest.date | date(format="%Y-%m-%d") }}</time></p>
{% endif %}
{% if latest.summary %}
{{ latest.summary | safe }}
{% else %}
<p>{{ latest.content | striptags | truncate(length=400) }}</p>
{% endif %}
<p><a href="{{ latest.permalink }}">Read more &rarr;</a></p>
</article>
{% if blog_section.pages | length > 1 %}
<h2>Recent Posts</h2>
<ul>
{% for page in blog_section.pages | slice(start=1, end=6) %}
<li>
{% if page.date %}
<time datetime="{{ page.date | date(format="%Y-%m-%d") }}">{{ page.date | date(format="%Y-%m-%d") }}</time>
{% endif %}
<a href="{{ page.permalink }}">{{ page.title }}</a>
</li>
{% endfor %}
</ul>
{% endif %}
<p><a href="{{ get_url(path='@/blog/_index.md') }}">All posts &rarr;</a></p>
{% endif %}
{% endblock content %}