From f9c6d70fd764453611414ee58a534679fbc2d7e7 Mon Sep 17 00:00:00 2001 From: eclipse Date: Mon, 10 Feb 2025 23:53:17 +0100 Subject: [PATCH] fixed algorithm so that wide_cards will stay in order --- theme/templates/wide-cards.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/theme/templates/wide-cards.html b/theme/templates/wide-cards.html index 7f38b35..fc5ae0b 100644 --- a/theme/templates/wide-cards.html +++ b/theme/templates/wide-cards.html @@ -1,8 +1,15 @@ {% extends "page.html" %} {% block content_body %} -{% for wcard in pages|selectattr("slug", "in", page.wide_cards)|list %} -{# {% for wide_card in page.wide_cards %} #} +{# build list of pages where the slugs correspond to an entries in page.wide_cards; some hackiness required to keep the +original order #} +{% set wcards = [] %} +{% for wide_card in page.wide_cards %} +{% do wcards.append(pages | selectattr("slug", "==", wide_card) | list | first) if pages | selectattr("slug", "==", +wide_card) | list | first is defined %} +{% endfor %} +{# now we can finally iterate over the pages listed in page.wide_cards #} +{% for wcard in wcards %}

{{ wcard.title }}