-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheleventy.config.js
104 lines (90 loc) · 3.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import { eleventyImageTransformPlugin } from '@11ty/eleventy-img';
import { feedPlugin } from '@11ty/eleventy-plugin-rss';
import eleventyPluginIcons from 'eleventy-plugin-icons';
import eleventyPluginNavigation from '@11ty/eleventy-navigation';
import eleventyPluginSyntaxHighlight from '@11ty/eleventy-plugin-syntaxhighlight';
import markdownIt from 'markdown-it';
import markdownItAbbr from 'markdown-it-abbr';
import markdownItAnchor from 'markdown-it-anchor';
import markdownItCallouts from 'markdown-it-obsidian-callouts';
import markdownItCollapsible from 'markdown-it-collapsible';
import markdownItFootnote from 'markdown-it-footnote';
export default async function(eleventyConfig) {
eleventyConfig.addWatchTarget('./src/css/');
eleventyConfig.addWatchTarget('./src/fonts/');
eleventyConfig.addWatchTarget('./src/img/');
eleventyConfig.addPassthroughCopy('./src/css/');
eleventyConfig.addPassthroughCopy('./src/fonts/');
eleventyConfig.addPassthroughCopy('./src/img/');
eleventyConfig.addPassthroughCopy({ "src/static": "/" });
eleventyConfig.addShortcode('year', () => `${new Date().getFullYear()}`);
eleventyConfig.addFilter('toDateObj', (dateString) => new Date(dateString));
eleventyConfig.addFilter('isoDate', (dateObj) => dateObj.toISOString());
eleventyConfig.addFilter('longDate', (dateObj) => dateObj.toString());
eleventyConfig.addFilter('readableDate', (dateObj) =>
dateObj.toLocaleDateString('en-US', {
year: 'numeric',
month: 'short',
day: 'numeric'
})
);
eleventyConfig.addCollection('posts', (collection) => collection.getFilteredByGlob('./src/posts/*.md'));
eleventyConfig.addPlugin(eleventyPluginIcons, {
mode: 'inline',
sources: [{ name: 'tablar', path: 'node_modules/@tabler/icons/icons/outline', default: true }, { name: 'lucide', path: 'node_modules/lucide-static/icons' }, { name: 'simple', path: 'node_modules/simple-icons/icons' }],
icon: {
shortcode: 'icon',
delimiter: ':',
transform: async (content) => content,
class: (name, source) => `icon icon-${name}`,
id: (name, source) => `icon-${name}`,
attributes: {},
attributesBySource: {},
overwriteExistingAttributes: true,
errorNotFound: true,
},
});
eleventyConfig.addPlugin(eleventyPluginNavigation);
eleventyConfig.addPlugin(eleventyPluginSyntaxHighlight);
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
// Plugin options go here
});
eleventyConfig.addPlugin(feedPlugin, {
type: "atom", // or "rss", "json"
outputPath: "/posts/feed.xml",
collection: {
name: "posts", // iterate over `collections.posts`
limit: 10, // 0 means no limit
},
metadata: {
language: "en",
title: "The Sweet Blog",
subtitle: "Dive into the latest posts on The Sweet Blog. Explore insightful stories and ideas.",
base: "https://parham.dev/posts/",
author: {
name: "Parham",
email: "[email protected]", // Optional
}
}
});
eleventyConfig.setLibrary('md', markdownIt({
html: true,
linkify: true,
typographer: true
}));
eleventyConfig.amendLibrary('md', (mdLib) =>
mdLib
.use(markdownItAbbr)
.use(markdownItAnchor)
.use(markdownItCollapsible)
.use(markdownItCallouts)
.use(markdownItFootnote)
);
};
export const config = {
dir: {
input: 'src',
output: 'public',
includes: '_includes'
}
};