summaryrefslogtreecommitdiff
path: root/eleventy.config.mjs
diff options
context:
space:
mode:
authorElis Eriksson <spelis@spelis.li>2026-07-07 22:35:51 +0200
committerElis Eriksson <spelis@spelis.li>2026-07-07 22:35:51 +0200
commitcda6973714d3770a887df6f6ff451636919170bb (patch)
treec1113f257d9982bf6982a31fd63b251eeec421fd /eleventy.config.mjs
parentbd65a742f81157b5c4c9fe399db65a0c1838f47d (diff)
downloadspelis-web-cda6973714d3770a887df6f6ff451636919170bb.tar
spelis-web-cda6973714d3770a887df6f6ff451636919170bb.tar.gz
spelis-web-cda6973714d3770a887df6f6ff451636919170bb.tar.bz2
spelis-web-cda6973714d3770a887df6f6ff451636919170bb.tar.lz
spelis-web-cda6973714d3770a887df6f6ff451636919170bb.tar.xz
spelis-web-cda6973714d3770a887df6f6ff451636919170bb.tar.zst
spelis-web-cda6973714d3770a887df6f6ff451636919170bb.zip
more aesthetic changes + code formatting
Diffstat (limited to 'eleventy.config.mjs')
-rw-r--r--eleventy.config.mjs190
1 files changed, 95 insertions, 95 deletions
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"
};