diff --git a/templates/index.html b/templates/index.html index 0aafa0b..01e068f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,19 +3,13 @@ {% import "macros.html" as macros %} {% block content %} - {% for page in section.pages | reverse %} -

{{ page.title }}

- {% if page.date %} - {{ page.date | date(format="%Y-%m-%d") }}{% if page.extra.author %}, by {{ page.extra.author }}{% endif %} - {% endif %} - {% if page.summary %} - {% if config.extra.summary_max_length %} - {% set sum = page.summary | safe | truncate(length=config.extra.summary_max_length) %} - {% else %} - {% set sum = page.summary | safe %} - {% endif %} -

{{ sum | safe }}

- {% endif %} + {% if section.extra.reverse_order | default(value=true) %} + {% set pages = section.pages | reverse %} + {% else %} + {% set pages = section.pages %} + {% endif %} + {% for page in pages %} + {{ macros::render_article_summary(page=page) }} {% if not loop.last %}
{% endif %} {% endfor %} {% endblock %} diff --git a/templates/macros.html b/templates/macros.html index f63822e..9600e64 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -16,6 +16,50 @@ {% endif %} {% endmacro typeof %} +{% macro render_article_summary(page) %} +

{{ page.title }}

+ {% set d = page.date is defined %} + {% set a = page.extra.author is defined %} + {% set r = page.reading_time is defined %} + {% if d or a or r %} + + + {% if d %}{% if a %}, {% endif %}{% endif %}{% if a %}by {{ page.extra.author }}{% endif %} + + {% if page.reading_time %}{{ page.reading_time }} minute read{% endif %} + + {% endif %} + {% if page.summary %} + {% if config.extra.summary_max_length %} + {{ page.summary | safe | truncate(length=config.extra.summary_max_length) }} + {% else %} + {{ page.summary | safe }} + {% endif %} + {% endif %} +{% endmacro render_article_summary %} + +{% macro toc(page) %} + +{% endmacro toc %} + {% macro debug(thing, label="", recurse=0) %} {% set type = self::typeof(thing=thing) | trim %} diff --git a/templates/page.html b/templates/page.html index 7fdb109..6f2e718 100644 --- a/templates/page.html +++ b/templates/page.html @@ -31,11 +31,16 @@ {% endif %} Read time: minutes {% if page.extra.external_reading %} + +
+ Table of Contents: + {{ macros::toc(page=page) }} +
External reading: diff --git a/templates/section.html b/templates/section.html index fbb25f0..6ae84dd 100644 --- a/templates/section.html +++ b/templates/section.html @@ -4,18 +4,7 @@ {% block content %} {% for page in section.pages | reverse %} -

{{ page.title }}

- {% if page.date %} - {{ page.date | date(format="%Y-%m-%d") }} - {% endif %} - {% if page.summary %} - {% if config.extra.summary_max_length %} - {% set sum = page.summary | safe | truncate(length=config.extra.summary_max_length) %} - {% else %} - {% set sum = page.summary | safe %} - {% endif %} -

{{ sum | safe }}

- {% endif %} + {{ macros::render_article_summary(page=page) }} {% if not loop.last %}
{% endif %} {% endfor %} {% endblock %} diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html index aa0da5b..dd83a71 100644 --- a/templates/shortcodes/img.html +++ b/templates/shortcodes/img.html @@ -1,6 +1,6 @@ {# {{ img(url="", alt="", caption="", resize=false, allow_tall=false) }} #} -{% set article_width = 960 %} +{% set article_width = 1280 %} {% if resize %} {% set effective_image = resize_image(path=url, width=article_width, op="fit_width") %} @@ -8,13 +8,15 @@ {% set effective_image = get_image_metadata(path=url) %} {% endif %} +{% set full_image_url = get_url(path=url) %} + {% set crop_height = config.extra.image_vertical_crop_height | default(value=768) %} {% set cropped = effective_image.height > crop_height and not allow_tall %}
{{ alt }} {% if caption %}
{{ caption | safe }}
{% endif %} - {% if resize or cropped %}↗️ full size{% endif %} + {% if resize or cropped %}↗️ full size{% endif %} {% endif %}
\ No newline at end of file