Replace orderBySectionOrder filter with the built in sort filter

This commit is contained in:
Neil Brommer 2023-07-13 11:20:52 -07:00
parent db6c23d907
commit 7db728e7da
2 changed files with 1 additions and 4 deletions

View file

@ -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 {

View file

@ -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 %}
<h2 id="{{ section.data.title | slugify }}">{{ section.data.title }}</h2>
{% endif %}