d3c3nt

[DORMANT] a fairly decent theme for the zola static site engine
git clone git://git.figbert.com/d3c3nt.git
Log | Files | Refs | README | LICENSE

commit ddab2c232676266b6e9aca6b8471a1825791e434
parent a56478c8789326795c04bc2d32c7b411e913fda7
Author: FIGBERT <figbert@figbert.com>
Date:   Wed, 26 Aug 2020 17:20:06 -0700

:sparkles: Add page-list and page-preview Tera templates

Diffstat:
Mstatic/global.css | 4++--
Atemplates/page-list.html | 18++++++++++++++++++
Atemplates/page-preview.html | 14++++++++++++++
3 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/static/global.css b/static/global.css @@ -94,12 +94,12 @@ h6::before { vertical-align: top; } -.post-preview { +.page-preview { margin-top: 2rem; margin-bottom: 4rem; } -.post-preview > h3 { +.page-preview > h3 { margin: 0; } diff --git a/templates/page-list.html b/templates/page-list.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} + +{% import "page-preview.html" as page_macro %} + +{% block posthead %} + {% for page in section.pages %} + <link rel="prerender" href="{{ page.permalink }}" /> + {% endfor %} +{% endblock posthead %} + +{% block content %} + {{ section.content | safe }} + + {% for page in section.pages %} + {{ page_macro::page_preview(page=page) }} + {% endfor %} +{% endblock content %} + diff --git a/templates/page-preview.html b/templates/page-preview.html @@ -0,0 +1,14 @@ +{% macro page_preview(page) %} + <div class="page-preview"> + <h3><a href="{{ page.permalink }}">{{ page.title }}</a></h3> + <small>{{ page.date | date(format="%B %d, %Y") }} :: {{ page.word_count }} words :: {{ page.reading_time }} mins</small> + <div> + {% if page.summary -%} + {{ page.summary | markdown | safe }} + {% else %} + {{ page.content | safe | striptags | truncate(length=300) }} + {%- endif %} + </div> + </div> +{% endmacro input %} +