fixed algorithm so that wide_cards will stay in order

This commit is contained in:
eclipse 2025-02-10 23:53:17 +01:00
parent 59cb812af0
commit f9c6d70fd7

View File

@ -1,8 +1,15 @@
{% extends "page.html" %} {% extends "page.html" %}
{% block content_body %} {% block content_body %}
{% for wcard in pages|selectattr("slug", "in", page.wide_cards)|list %} {# build list of pages where the slugs correspond to an entries in page.wide_cards; some hackiness required to keep the
{# {% for wide_card in page.wide_cards %} #} 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 %}
<article class="wcard"> <article class="wcard">
<header> <header>
<h3><a href="{{ SITEURL }}/{{ wcard.title|lower }}/">{{ wcard.title }}</a></h3> <h3><a href="{{ SITEURL }}/{{ wcard.title|lower }}/">{{ wcard.title }}</a></h3>