homepage/.eleventy.js
2025-10-31 13:46:36 +01:00

36 lines
1.3 KiB
JavaScript

const UpgradeHelper = require("@11ty/eleventy-upgrade-help");
const markdownIt = require("markdown-it");
module.exports = function(eleventyConfig) {
eleventyConfig.addPlugin(UpgradeHelper);
// Copying static assets
eleventyConfig.addPassthroughCopy("src/style.css");
eleventyConfig.addPassthroughCopy("src/photo.png");
eleventyConfig.addPassthroughCopy("src/advent_pro_500.woff2");
eleventyConfig.addPassthroughCopy("src/advent_pro_600.woff2");
eleventyConfig.addPassthroughCopy("src/updock_400.woff2");
eleventyConfig.addPassthroughCopy("src/LMRoman10-Bold.woff2");
eleventyConfig.addPassthroughCopy("src/LMRoman10-Regular.woff2");
// Configuring permalinks to be ~.html instead of ~/
eleventyConfig.addGlobalData("permalink", () => {
return (data) => `${data.page.filePathStem}.${data.page.outputFileExtension}`;
});
eleventyConfig.addFilter("formatDate", (dateString) => {
if (!dateString) return "Present";
const date = new Date(dateString);
return date.toLocaleDateString('en-US', { year: 'numeric', month: 'short' });
});
eleventyConfig.addFilter("markdown", (str) => markdownIt().render(str));
// Options
return {
dir: {
input: "src",
output: "dist"
}
}
};