import { feedPlugin } from "@11ty/eleventy-plugin-rss";
import filtersPlugin from "./src/_config/filters.js";
/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
export default async function(eleventyConfig) {
eleventyConfig.addDateParsing(function(dateValue) {
if (dateValue != null && typeof(dateValue) === 'object') {
dateValue = new Date(dateValue.getFullYear(), dateValue.getMonth(), dateValue.getDate() + 1);
}
return dateValue; // fallback
});
eleventyConfig.addPassthroughCopy(
{'./public/': '/'}
);
eleventyConfig.addPlugin(feedPlugin, {
type: "atom",
outputPath: "/feed.xml",
collection: {
name: "posts", // iterate over `collections.posts`
limit: 25, // 0 means no limit
},
metadata: {
language: "en",
title: "Cy-by-Side",
subtitle: "Cy by Side with Cyper: Tangents, Tech, and Thoughtful Takes.",
base: "https://cy.cyper.cc/",
author: {
name: "Cyper"
}
}
});
eleventyConfig.addPlugin(filtersPlugin);
eleventyConfig.addShortcode("triangleSvg", function(strokeWidth = 10) {
const w = parseFloat(strokeWidth);
if (isNaN(w) || w <= 0) {
throw new Error("strokeWidth must be a positive number");
}
// Scale offsets based on strokeWidth
const topInset = +(w * 1.05).toFixed(2);
const bottomInset = +(w * 0.5).toFixed(2);
const sideInset = +(w * 0.8).toFixed(2);
const topPoint = `50,${topInset}`;
const leftPoint = `${sideInset},${100 - bottomInset}`;
const rightPoint = `${100 - sideInset},${100 - bottomInset}`;
const points = `${topPoint} ${leftPoint} ${rightPoint}`;
return `
`;
});
eleventyConfig.addShortcode("squareSvg", function(strokeWidth = 10, className = "square") {
const w = parseFloat(strokeWidth);
if (isNaN(w) || w <= 0) {
throw new Error("strokeWidth must be a positive number");
}
const inset = +(w / 2).toFixed(2);
const x1 = inset;
const y1 = inset;
const x2 = 100 - inset;
const y2 = 100 - inset;
return `
`;
});
}