-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
92 lines (77 loc) · 3.1 KB
/
.eleventy.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
require('dotenv').config();
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const rss = require('@11ty/eleventy-plugin-rss');
const { eleventyImageTransformPlugin } = require("@11ty/eleventy-img");
const embedYouTube = require('eleventy-plugin-youtube-embed');
const embedTwitter = require('eleventy-plugin-embed-twitter');
const timeToRead = require('eleventy-plugin-time-to-read');
const tableOfContents = require('eleventy-plugin-nesting-toc');
const externalLinks = require('@aloskutov/eleventy-plugin-external-links');
const util = require('node:util');
const addAllShortcodes = require('./_eleventy/shortcodes');
const addAllFilters = require('./_eleventy/filters');
const markdownLib = require('./_eleventy/markdown');
const site = require('./src/_data/site');
const addCollections = require('./_eleventy/collections');
module.exports = (eleventyConfig) => {
// Plugins
eleventyConfig.addPlugin(eleventyImageTransformPlugin);
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(embedYouTube);
eleventyConfig.addPlugin(embedTwitter);
eleventyConfig.addPlugin(timeToRead, { style: 'short' });
eleventyConfig.addPlugin(tableOfContents, { tags: ['h2'] });
eleventyConfig.addPlugin(externalLinks, {
url: site.url,
overwrite: false,
rel: ['noreferrer', 'noopener', 'external'],
});
// Collections
addCollections(eleventyConfig);
// RSS
eleventyConfig.addPlugin(rss);
eleventyConfig.addLiquidFilter('dateToRfc3339', rss.dateToRfc3339);
eleventyConfig.addLiquidFilter(
'getNewestCollectionItemDate',
rss.getNewestCollectionItemDate
);
eleventyConfig.addLiquidFilter('absoluteUrl', rss.absoluteUrl);
eleventyConfig.addLiquidFilter(
'convertHtmlToAbsoluteUrls',
rss.convertHtmlToAbsoluteUrls
);
eleventyConfig.setLibrary('md', markdownLib);
// Copy
eleventyConfig.addPassthroughCopy({ 'src/images': 'images' });
eleventyConfig.addPassthroughCopy({ 'src/favicons': 'favicons' });
eleventyConfig.addPassthroughCopy({ 'src/robots.txt': 'robots.txt' });
eleventyConfig.addPassthroughCopy({ 'src/ads.txt': 'ads.txt' });
eleventyConfig.addPassthroughCopy({
'src/browserconfig.xml': 'browserconfig.xml',
});
eleventyConfig.addPassthroughCopy({ 'src/distjs/': 'js/' });
eleventyConfig.addPassthroughCopy({
'./_tmp/css/main.css': 'css/main.css',
});
eleventyConfig.addPassthroughCopy({ 'src/_redirects': '_redirects' });
// Watch - including files in .gitignore
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addWatchTarget('./src/distjs/');
eleventyConfig.addWatchTarget('./_tmp/css/main.css');
addAllFilters(eleventyConfig);
addAllShortcodes(eleventyConfig);
// Debug filter
eleventyConfig.addFilter('console', (value) => {
return util.inspect(value);
});
eleventyConfig.setDataDeepMerge(true);
eleventyConfig.setLiquidOptions({
dynamicPartials: false,
});
return {
dir: {
input: './src',
output: './_site',
},
};
};