From 9249d9fbbe5a8fdafc58951873f1e75220c4aeef Mon Sep 17 00:00:00 2001 From: Daniel Kessler Date: Thu, 18 Apr 2024 14:58:50 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20link=20'All=20posts'=20to?= =?UTF-8?q?=20proper=20section=20(#295)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Daniel Kessler (a.k.a. Dalker) Co-authored-by: welpo --- templates/macros/list_posts.html | 4 ++-- templates/section.html | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/templates/macros/list_posts.html b/templates/macros/list_posts.html index d0f2fcc..8c2e1bf 100644 --- a/templates/macros/list_posts.html +++ b/templates/macros/list_posts.html @@ -1,4 +1,4 @@ -{% macro list_posts(posts, max, language_strings="") %} +{% macro list_posts(posts, max, language_strings="", section_path="blog") %}
{% for post in posts %} @@ -46,7 +46,7 @@ {% if not loop.last %} {% if loop.index == max %} {% endif %} {% endif %} diff --git a/templates/section.html b/templates/section.html index b30fab4..935bf5a 100644 --- a/templates/section.html +++ b/templates/section.html @@ -7,6 +7,12 @@ {% set extra_section = get_section(path=section.extra.section_path) %} {% endif -%} +{% if section.extra.section_path -%} + {% set path = section.extra.section_path | replace(from="/_index.md", to = "") %} +{% else -%} + {% set path = section.path %} +{% endif -%} + {%- if section.extra.header %} {%- include "partials/home_banner.html" -%} {% endif -%} @@ -23,7 +29,7 @@ {% endif -%} {% set max = section.extra.max_posts | default(value=999999) %} - {{ macros_list_posts::list_posts(posts=pages, max=max, language_strings=language_strings) }} + {{ macros_list_posts::list_posts(posts=pages, max=max, language_strings=language_strings, section_path=path) }}