diff --git a/eleventy.config.js b/eleventy.config.js index 55a6fe6..dbbf1f0 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -3,24 +3,23 @@ module.exports = function(eleventyConfig) { eleventyConfig.addCollection("publishedEditions", function(collectionApi) { return collectionApi.getFilteredByGlob("content/editions/*/index.md") .filter(item => item.data.status === "published") - .sort((a, b) => b.date - a.date); // Sort descending + .sort((a, b) => b.date - a.date); }); - // 2. Collection: The current (newest) published edition for the index page + // 2. Collection: The current (newest) published edition eleventyConfig.addCollection("currentEdition", function(collectionApi) { const published = collectionApi.getFilteredByGlob("content/editions/*/index.md") .filter(item => item.data.status === "published") .sort((a, b) => b.date - a.date); - return published.length > 0 ? [published[0]] : []; }); - // 3. Layout aliases so you don't have to type the full path in front matter + // 3. Layout aliases eleventyConfig.addLayoutAlias("edition", "layouts/edition.njk"); eleventyConfig.addLayoutAlias("article", "layouts/article.njk"); eleventyConfig.addLayoutAlias("base", "layouts/base.njk"); - // 4. Force UTC date formatting to fix the 5-hour timezone shift + // 4. Filters eleventyConfig.addFilter("newsDate", function(dateObj) { return new Date(dateObj).toLocaleDateString('en-US', { timeZone: 'UTC', @@ -31,7 +30,6 @@ module.exports = function(eleventyConfig) { }); }); - eleventyConfig.addFilter("roman", function(num) { const lookup = {M:1000,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}; let roman = ''; @@ -40,14 +38,15 @@ module.exports = function(eleventyConfig) { roman += i; num -= lookup[i]; } - } return roman; } - ); + } + return roman; + }); - module.exports = function(eleventyConfig) { + // 5. Directory configuration (integrated into the same function) return { dir: { input: "content", - includes: "../_includes", // Keeps templates safely outside the content dir + includes: "../_includes", output: "dist" }, templateFormats: ["md", "njk", "html"]