Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { exec } = require("child_process");
const glob = require("fast-glob");
const { DateTime } = require("luxon");
const { DateTime } = require("luxon");
const fs = require("fs");

const pluginAddIdToHeadings = require("@orchidjs/eleventy-plugin-ids");
const pluginRss = require("@11ty/eleventy-plugin-rss");
Expand Down Expand Up @@ -48,6 +49,24 @@ module.exports = function (eleventyConfig) {
eleventyConfig.ignores.add("src/nl/vereniging/bestuur/notulen");
}

// Custom date filter
eleventyConfig.addFilter("localizedDate", function (dateObj, locale = "en") {
return DateTime.fromJSDate(dateObj).setLocale(locale).toFormat("d LLLL yyyy");
});
eleventyConfig.addFilter("bust", (url) => {
const [urlPart, paramPart] = url.split("?");
const params = new URLSearchParams(paramPart || "");
const relativeUrl = (urlPart.charAt(0) == "/") ? urlPart.substring(1) : urlPart;

try {
const fileStats = fs.statSync(relativeUrl);
const dateTimeModified = new DateTime(fileStats.mtime).toFormat("X");
params.set("v", dateTimeModified);
} catch (error) { }

return `${urlPart}?${params}`;
});

// Custom date filter
eleventyConfig.addFilter("localizedDate", function (dateObj, locale = "en") {
return DateTime.fromJSDate(dateObj)
Expand Down
2 changes: 1 addition & 1 deletion src/_includes/partials/utility/html-head.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{%- endif -%}
{%- endif -%}

<link rel="stylesheet" href="/assets/css/style.css?v=">
<link rel="stylesheet" href="/assets/css/style.css">

<link rel="preload" as="font" href="/assets/fonts/Fabrik-Bold.woff2" type="font/woff2" crossorigin="anonymous">
<link rel="preload" as="font" href="/assets/fonts/Roboto-Regular.woff2" type="font/woff2" crossorigin="anonymous">
Expand Down