summaryrefslogtreecommitdiff
path: root/eleventy.config.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'eleventy.config.mjs')
-rw-r--r--eleventy.config.mjs38
1 files changed, 28 insertions, 10 deletions
diff --git a/eleventy.config.mjs b/eleventy.config.mjs
index 58fad4e..0ed461a 100644
--- a/eleventy.config.mjs
+++ b/eleventy.config.mjs
@@ -77,16 +77,34 @@ export default function(eleventyConfig) {
},
});
- eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
- widths: [200, "auto"],
- htmlOptions: {
- imgAttributes: {
- loading: "lazy",
- decoding: "async",
- },
- pictureAttributes: {}
- },
- });
+ eleventyConfig.addGlobalData("age", () => {
+ const birthday = new Date("2010-05-11");
+
+ const today = new Date();
+
+ let age = today.getFullYear() - birthday.getFullYear();
+
+ if (
+ today.getMonth() < birthday.getMonth() ||
+ (today.getMonth() === birthday.getMonth() &&
+ today.getDate() < birthday.getDate())
+ ) {
+ age--;
+ }
+
+ return age;
+ });
+
+ // eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
+ // widths: [200, "auto"],
+ // htmlOptions: {
+ // imgAttributes: {
+ // loading: "lazy",
+ // decoding: "async",
+ // },
+ // pictureAttributes: {}
+ // },
+ // });
eleventyConfig.addBundle("css", {
toFileDirectory: "assets/css/bundles/",