Open dara-icf opened 1 month ago
11ty doesn't have sort out-of the box (aside from create date -- and reverse create date)
we tried a few code blocks in the config file including
eleventyConfig.addCollection("patterns", function (collectionApi) { return collectionApi.getAll().sort(function (a, b) { //return a.date - b.date; // sort by date - ascending return a.title - b.title; // sort by date - descending //return a.inputPath.localeCompare(b.inputPath); // sort by path - ascending //return b.inputPath.localeCompare(a.inputPath); // sort by path - descending }); });
and
eleventyConfig.addCollection("patterns", collection => collection .getAll() .filter(function(item) { return "patterns" in item.data; }) .sort((a, b) => { return (a.data.patterns.title - b.data.patterns.title); }) );
A hackey way to do this is to just date: the files in YAML.
date:
Not sustainable -- but since components are slow to come out of USWDS... maybe this works 🤷🏽♀️
11ty doesn't have sort out-of the box (aside from create date -- and reverse create date)
we tried a few code blocks in the config file including
and