From 7db728e7da2adff9131e933ec85bed0b24078b54 Mon Sep 17 00:00:00 2001 From: Neil Brommer Date: Thu, 13 Jul 2023 11:20:52 -0700 Subject: [PATCH] Replace orderBySectionOrder filter with the built in sort filter --- eleventy.config.js | 3 --- src/index.njk | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/eleventy.config.js b/eleventy.config.js index 46f18c1..c3d215d 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -56,9 +56,6 @@ module.exports = function (eleventyConfig) { return true; }); }); - eleventyConfig.addFilter("orderBySectionOrder", (collection) => - collection.sort((a, b) => a.data.sectionOrder - b.data.sectionOrder) - ); eleventyConfig.addFilter("log", (value) => console.log(value)); return { diff --git a/src/index.njk b/src/index.njk index 2e7cf59..d230623 100644 --- a/src/index.njk +++ b/src/index.njk @@ -7,7 +7,7 @@ eleventyNavigation: tags: [ "MainPage" ] --- -{% for section in collections.MainPage | IsNotPage(page.url) | IsMainPageSection | orderBySectionOrder %} +{% for section in collections.MainPage | IsNotPage(page.url) | IsMainPageSection | sort(false, false, "data.sectionOrder") %} {% if not loop.first %}

{{ section.data.title }}

{% endif %}