-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
40 lines (33 loc) · 950 Bytes
/
.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
const pluginSEO = require('eleventy-plugin-seo');
const Image = require('@11ty/eleventy-img');
const imageShortCode = async (src, alt, sizes) => {
let metadata = await Image(src, {
widths: [480, 640, null],
urlPath: './assets/images',
outputDir: './_site/assets/images'
});
let imageAttributes = {
alt,
sizes,
class: 'rounded-lg',
loading: 'lazy',
decoding: 'async'
};
return Image.generateHTML(metadata, imageAttributes);
};
module.exports = (eleventyConfig) => {
eleventyConfig.addNunjucksAsyncShortcode('image', imageShortCode);
eleventyConfig.addPlugin(pluginSEO, require('./src/_data/seo.json'));
eleventyConfig.addPassthroughCopy('./src/assets');
eleventyConfig.addPassthroughCopy('./src/robots.txt');
eleventyConfig.addPassthroughCopy('./src/sitemap.xml');
return {
HTMLTemplateEngine: 'njk',
pathPrefix: '/',
dir: {
input: 'src',
includes: '_includes',
layouts: '_includes/layouts'
}
};
};