From 8f46909ebff0c2822bd65dc7d62d2975b1aaa13e Mon Sep 17 00:00:00 2001 From: Marc Froehlich Date: Tue, 7 Jul 2026 00:12:20 +0200 Subject: [PATCH] Add ordered and featured feature collections --- website/.eleventy.js | 14 ++++++++++++++ website/src/_layouts/feature.njk | 2 +- website/src/index.njk | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/website/.eleventy.js b/website/.eleventy.js index a0d1e3d..f8f7c68 100644 --- a/website/.eleventy.js +++ b/website/.eleventy.js @@ -28,6 +28,20 @@ function rewriteManualLinks(content, lang) { module.exports = function (eleventyConfig) { + eleventyConfig.addCollection("sortedFeatures", function (collectionApi) { + return collectionApi.getFilteredByTag("features").sort((a, b) => { + return (a.data.order || 999) - (b.data.order || 999); + }); + }); + + eleventyConfig.addCollection("featuredFeatures", function (collectionApi) { + return collectionApi.getFilteredByTag("features") + .filter(item => item.data.featured) + .sort((a, b) => { + return (a.data.order || 999) - (b.data.order || 999); + }); + }); + eleventyConfig.addFilter("whereTag", function(collection, tag) { return collection.filter(item => item.data.tags && item.data.tags.includes(tag)); }); diff --git a/website/src/_layouts/feature.njk b/website/src/_layouts/feature.njk index d66ec02..527d459 100644 --- a/website/src/_layouts/feature.njk +++ b/website/src/_layouts/feature.njk @@ -27,7 +27,7 @@ layout: base.njk

Related features

{% for slug in related %} - {% for item in collections.features %} + {% for item in collections.sortedFeatures %} {% if item.fileSlug == slug %} {{ item.data.title }} {% endif %} diff --git a/website/src/index.njk b/website/src/index.njk index 6fd94d5..041a132 100644 --- a/website/src/index.njk +++ b/website/src/index.njk @@ -28,7 +28,7 @@ description: KST4Contest is a modern ON4KST chat client built for VHF, UHF and S
- {% for feature in collections.features %} + {% for feature in collections.sortedFeatures %} {% if loop.index <= 6 %}
{{ feature.data.icon }} {{ feature.data.title }}