From cda6973714d3770a887df6f6ff451636919170bb Mon Sep 17 00:00:00 2001 From: Elis Eriksson Date: Tue, 7 Jul 2026 22:35:51 +0200 Subject: more aesthetic changes + code formatting --- eleventy.config.mjs | 190 ++++++++++++++++++++++++++-------------------------- 1 file changed, 95 insertions(+), 95 deletions(-) (limited to 'eleventy.config.mjs') diff --git a/eleventy.config.mjs b/eleventy.config.mjs index 0ed461a..15def51 100644 --- a/eleventy.config.mjs +++ b/eleventy.config.mjs @@ -1,4 +1,4 @@ -import { parseISO , format} from "date-fns"; +import { parseISO, format } from "date-fns"; import { config as siteConfig } from "./siteconfig.mjs"; import { eleventyImageTransformPlugin } from "@11ty/eleventy-img"; import markdownIt from "markdown-it"; @@ -11,65 +11,65 @@ import sitemap from "@quasibit/eleventy-plugin-sitemap"; import { DateTime } from "luxon"; export class CustomOgImage extends OgImage { - async shortcodeOutput() { - return this.outputUrl(); - } + async shortcodeOutput() { + return this.outputUrl(); + } } export default function(eleventyConfig) { // Order matters, put this at the top of your configuration file. - eleventyConfig.addFilter("embedSVG", function(filePath) { - const fullPath = path.join("./", filePath); - return fs.readFileSync(fullPath, "utf-8"); - }); + eleventyConfig.addFilter("embedSVG", function(filePath) { + const fullPath = path.join("./", filePath); + return fs.readFileSync(fullPath, "utf-8"); + }); eleventyConfig.addNunjucksFilter("date", (dateObj, formatString) => { return DateTime.fromJSDate(dateObj).toFormat( formatString || "cccc, LLLL dd yyyy" ); }); - eleventyConfig.addCollection("navItems", function (collectionsApi) { - return collectionsApi.getAll().filter(i => { - if (i.data.nav) { - return i.data.nav > 0 - } - }).sort(function (a, b) { + eleventyConfig.addCollection("navItems", function(collectionsApi) { + return collectionsApi.getAll().filter(i => { + if (i.data.nav) { + return i.data.nav > 0 + } + }).sort(function(a, b) { return (a.data.nav ?? -1000) - (b.data.nav ?? -1000); }); }); - eleventyConfig.addPlugin(syntaxHighlight); - eleventyConfig.addPlugin(EleventyPluginOgImage, { - satoriOptions: { - fonts: [ - { - name: 'JetBrains Mono', - data: fs.readFileSync('./assets/fonts/JetBrains/OG-Regular.ttf'), - weight: 400, - style: 'normal', - }, - { - name: 'JetBrains Mono', - data: fs.readFileSync('./assets/fonts/JetBrains/OG-Bold.ttf'), - weight: 800, - style: 'normal', - }, - { - name: 'Kode Mono', - data: fs.readFileSync('./assets/fonts/KodeMono/Regular.ttf'), - weight: 400, - style: 'normal', - }, - { - name: 'Kode Mono', - data: fs.readFileSync('./assets/fonts/KodeMono/Bold.ttf'), - weight: 800, - style: 'normal', - }, - ], - }, - OgImage: CustomOgImage, - }); + eleventyConfig.addPlugin(syntaxHighlight); + eleventyConfig.addPlugin(EleventyPluginOgImage, { + satoriOptions: { + fonts: [ + { + name: 'JetBrains Mono', + data: fs.readFileSync('./assets/fonts/JetBrains/OG-Regular.ttf'), + weight: 400, + style: 'normal', + }, + { + name: 'JetBrains Mono', + data: fs.readFileSync('./assets/fonts/JetBrains/OG-Bold.ttf'), + weight: 800, + style: 'normal', + }, + { + name: 'Kode Mono', + data: fs.readFileSync('./assets/fonts/KodeMono/Regular.ttf'), + weight: 400, + style: 'normal', + }, + { + name: 'Kode Mono', + data: fs.readFileSync('./assets/fonts/KodeMono/Bold.ttf'), + weight: 800, + style: 'normal', + }, + ], + }, + OgImage: CustomOgImage, + }); eleventyConfig.addPlugin(sitemap, { sitemap: { @@ -78,78 +78,78 @@ export default function(eleventyConfig) { }); eleventyConfig.addGlobalData("age", () => { - const birthday = new Date("2010-05-11"); + const birthday = new Date("2010-05-11"); - const today = new Date(); + const today = new Date(); - let age = today.getFullYear() - birthday.getFullYear(); + let age = today.getFullYear() - birthday.getFullYear(); - if ( - today.getMonth() < birthday.getMonth() || - (today.getMonth() === birthday.getMonth() && - today.getDate() < birthday.getDate()) - ) { - age--; - } + if ( + today.getMonth() < birthday.getMonth() || + (today.getMonth() === birthday.getMonth() && + today.getDate() < birthday.getDate()) + ) { + age--; + } - return age; + return age; }); - // eleventyConfig.addPlugin(eleventyImageTransformPlugin, { - // widths: [200, "auto"], - // htmlOptions: { - // imgAttributes: { - // loading: "lazy", - // decoding: "async", - // }, - // pictureAttributes: {} - // }, - // }); + eleventyConfig.addPlugin(eleventyImageTransformPlugin, { + widths: [200, "auto"], + htmlOptions: { + imgAttributes: { + loading: "lazy", + decoding: "async", + }, + pictureAttributes: {} + }, + }); - eleventyConfig.addBundle("css", { - toFileDirectory: "assets/css/bundles/", + eleventyConfig.addBundle("css", { + toFileDirectory: "assets/css/bundles/", // (Optional) File extension used for bundle file output, defaults to bundle name outputFileExtension: "css", - }); + }); - eleventyConfig.addBundle("js", { - toFileDirectory: "assets/js/bundles/", + eleventyConfig.addBundle("js", { + toFileDirectory: "assets/js/bundles/", // (Optional) File extension used for bundle file output, defaults to bundle name outputFileExtension: "js", - }); + }); - eleventyConfig.addGlobalData("layout","page"); - eleventyConfig.addGlobalData("site", { - title: siteConfig.siteTitle ?? "Site", - headerLinks: siteConfig.headerLinks ?? [], - footerLinks: siteConfig.footerLinks ?? [] - }) + eleventyConfig.addGlobalData("layout", "page"); + eleventyConfig.addGlobalData("site", { + title: siteConfig.siteTitle ?? "Site", + headerLinks: siteConfig.headerLinks ?? [], + footerLinks: siteConfig.footerLinks ?? [] + }) - let options = { + let options = { html: true, breaks: true, linkify: true, - langPrefix: 'codeblock language-', + langPrefix: 'codeblock language-', }; eleventyConfig.setLibrary("md", markdownIt(options)); - - eleventyConfig - .addPassthroughCopy({"./public/": "/"}) - .addPassthroughCopy({"./assets/": "/assets"}) - .addPassthroughCopy({"./assets/images/favicon.ico": "/favicon.ico"}) + + eleventyConfig + .addPassthroughCopy({ "./public/": "/" }) + .addPassthroughCopy({ "./assets/": "/assets" }) + .addPassthroughCopy({ "./assets/images/favicon.ico": "/favicon.ico" }) }; export const config = { - dir: { - input: "content", - output: "_dist", - includes: "../_includes", - layouts: "../_layouts", - }, - templateFormats: ["md", "njk"], - htmlTemplateEngine: "njk", - markdownTemplateEngine: "njk" + dir: { + input: "content", + output: "_dist", + includes: "../_includes", + layouts: "../_layouts", + }, + templateFormats: ["md", "njk"], + htmlTemplateEngine: "njk", + markdownTemplateEngine: "njk" }; -- cgit v1.3-7-ge9ab