91 lines
2.3 KiB
JavaScript
91 lines
2.3 KiB
JavaScript
import { feedPlugin } from "@11ty/eleventy-plugin-rss";
|
|
|
|
/** @param {import("@11ty/eleventy").UserConfig} eleventyConfig */
|
|
export default async function(eleventyConfig) {
|
|
eleventyConfig.addPassthroughCopy(
|
|
{'./public/': '/'}
|
|
);
|
|
|
|
eleventyConfig.addPlugin(feedPlugin, {
|
|
type: "atom",
|
|
outputPath: "/atom.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.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 `
|
|
<svg viewBox="0 0 100 100" width="100%" height="100%" preserveAspectRatio="xMidYMid meet" aria-hidden="true" focusable="false">
|
|
<polygon
|
|
points="${points}"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="${w}"
|
|
stroke-linejoin="miter"
|
|
/>
|
|
</svg>`;
|
|
});
|
|
|
|
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 `
|
|
<svg
|
|
class="${className}"
|
|
viewBox="0 0 100 100"
|
|
width="100%"
|
|
height="100%"
|
|
preserveAspectRatio="xMidYMid meet"
|
|
aria-hidden="true"
|
|
focusable="false"
|
|
>
|
|
<rect
|
|
class="${className}__shape"
|
|
x="${x1}"
|
|
y="${y1}"
|
|
width="${(x2 - x1).toFixed(2)}"
|
|
height="${(y2 - y1).toFixed(2)}"
|
|
stroke="currentColor"
|
|
fill="none"
|
|
stroke-width="${w}"
|
|
stroke-linejoin="miter"
|
|
/>
|
|
</svg>`;
|
|
});
|
|
} |