From fa4b40771c46552c2dd8480e1f82f3c3bd8cb5f7 Mon Sep 17 00:00:00 2001 From: Jalil Arfaoui Date: Tue, 26 Dec 2023 13:41:26 +0100 Subject: [PATCH] feat: metas dynamiques --- .eleventy.js | 7 +++-- src/_includes/layouts/base.njk | 54 ++++++---------------------------- src/araberlin.njk | 2 ++ src/il.njk | 2 ++ 4 files changed, 18 insertions(+), 47 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index 5b91fc6..7aaf7ad 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -13,8 +13,8 @@ const markdownItOptions = { } const parseDate = (date) => typeof date === 'string' ? - DateTime.fromISO(date) : - DateTime.fromJSDate(date, {zone: 'utc'}) + DateTime.fromISO(date).setZone("Europe/Paris") : + DateTime.fromJSDate(date, {zone: 'utc'}).setZone("Europe/Paris") async function imageShortcode(src, alt, sizes) { let metadata = await Image(src, { @@ -64,6 +64,9 @@ module.exports = function(eleventyConfig) { eleventyConfig.addFilter('htmlDateString', (dateObj) => { return parseDate(dateObj).toFormat('yyyy-LL-dd'); }); + eleventyConfig.addFilter('htmlDateTimeISO', (dateObj) => { + return parseDate(dateObj).toISO(); + }); // Get the first `n` elements of a collection. eleventyConfig.addFilter("head", (array, n) => { diff --git a/src/_includes/layouts/base.njk b/src/_includes/layouts/base.njk index 756d3ee..fe15a5e 100644 --- a/src/_includes/layouts/base.njk +++ b/src/_includes/layouts/base.njk @@ -1,65 +1,29 @@ ---- -layout: layouts/html.njk ---- - - - Compagnie Kalimat - - - - + {{ title or metadata.title or "Compagnie Kalimat" }} + {% if description %}{% endif %} - + - + {% if description %}{% endif %} - - - + + + - - - + {% if description %}{% endif %} + - - - - - - - - - - - - - -