-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheleventy.config.ts
More file actions
39 lines (34 loc) · 985 Bytes
/
eleventy.config.ts
File metadata and controls
39 lines (34 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import "tsx/esm";
import { renderToStaticMarkup } from "react-dom/server";
export default function (eleventyConfig: any) {
eleventyConfig.addExtension(["11ty.tsx"], {
key: "11ty.js",
compile: function () {
return async function (data: any) {
let content = await this.defaultRenderer(data);
return `<!doctype html>\n${renderToStaticMarkup(content)}`;
};
},
compileOptions: {
permalink: function () {
return (data: any) => {
if (data.page.fileSlug === "404") {
return `/404.html`;
}
return undefined;
};
},
},
});
eleventyConfig.addTemplateFormats("11ty.tsx");
eleventyConfig.addPassthroughCopy({ "./public/": "/" });
eleventyConfig.addWatchTarget("./components/");
eleventyConfig.addWatchTarget("./content/");
eleventyConfig.addWatchTarget("./public/");
return {
htmlTemplateEngine: "11ty.js",
dir: {
input: "content",
},
};
}