-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheleventy.config.js
57 lines (52 loc) · 1.36 KB
/
eleventy.config.js
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const syntaxHighlightPlugin = require("@11ty/eleventy-plugin-syntaxhighlight");
const { feedPlugin } = require("@11ty/eleventy-plugin-rss");
module.exports = function (eleventyConfig) {
eleventyConfig.addCollection("published", (collection) => {
return collection
.getFilteredByTags("posts")
.filter((post) => !post.data.draft)
.sort((o, n) => n.date - o.date);
});
eleventyConfig.addPassthroughCopy("favicon.ico");
eleventyConfig.addPlugin(syntaxHighlightPlugin);
eleventyConfig.addPlugin(feedPlugin, {
type: "atom", // or "rss", "json"
outputPath: "/feed.xml",
collection: {
name: "posts", // iterate over `collections.posts`
limit: 10, // 0 means no limit
},
metadata: {
language: "en",
title: "Badr Choubai",
subtitle: "Badr Choubai's personal blog",
base: "https://badrchoubai.dev/",
author: {
name: "Badr Choubai",
},
},
});
eleventyConfig.addShortcode("postCard", function (postData) {
return `
<article class="post-card">
<hgroup>
<h3>
<a href="${postData.url}">${postData.title}</a>
</h3>
<p>${postData.date.toLocaleDateString("en-US")}</p>
</hgroup>
<p style="font-size: 1rem;">
${postData.premise}
<p>
</article>
`;
});
return {
dir: {
input: "src",
},
templateFormats: ["njk", "md"],
markdownTemplateEngine: "njk",
htmlTemplateEngine: "njk",
};
};