57 lines
1.7 KiB
JavaScript
57 lines
1.7 KiB
JavaScript
import { pathToFileURL } from "node:url";
|
|
import { evaluate } from "@mdx-js/mdx";
|
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
import * as runtime from "react/jsx-runtime";
|
|
import { feedPlugin } from "@11ty/eleventy-plugin-rss";
|
|
import { IdAttributePlugin } from "@11ty/eleventy";
|
|
|
|
export default function (eleventyConfig) {
|
|
eleventyConfig.setInputDirectory("site-src");
|
|
eleventyConfig.setLayoutsDirectory("layout");
|
|
eleventyConfig.setTemplateFormats(["mdx", "njk"]);
|
|
|
|
eleventyConfig.addExtension("mdx", {
|
|
compile: async (str, inputPath) => {
|
|
const { default: mdxContent } = await evaluate(str, {
|
|
...runtime,
|
|
baseUrl: pathToFileURL(inputPath),
|
|
});
|
|
|
|
return async function (data) {
|
|
let res = await mdxContent(data);
|
|
return renderToStaticMarkup(res);
|
|
};
|
|
},
|
|
});
|
|
|
|
eleventyConfig.addPlugin(feedPlugin, {
|
|
type: "atom",
|
|
outputPath: "/feed.xml",
|
|
collection: {
|
|
name: "post",
|
|
limit: 100,
|
|
},
|
|
metadata: {
|
|
language: "en",
|
|
title: "terezi.pyrope.net",
|
|
subtitle: "mehbark posts about whatever",
|
|
base: "https://terezi.pyrope.net/",
|
|
author: {
|
|
name: "mehbark",
|
|
},
|
|
},
|
|
});
|
|
|
|
eleventyConfig.addPlugin(IdAttributePlugin);
|
|
|
|
eleventyConfig.setNunjucksEnvironmentOptions({
|
|
throwOnUndefined: true,
|
|
});
|
|
|
|
eleventyConfig.addPassthroughCopy("site-src/res");
|
|
eleventyConfig.addPassthroughCopy("site-src/*.png");
|
|
eleventyConfig.addPassthroughCopy("site-src/**/*.html");
|
|
|
|
eleventyConfig.addGlobalData("layout", "page.njk");
|
|
}
|