-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.eleventy.js
80 lines (67 loc) · 2.24 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
import eleventyNavigationPlugin from "@11ty/eleventy-navigation"
import pluginRss from "@11ty/eleventy-plugin-rss"
import { eleventyImageTransformPlugin } from "@11ty/eleventy-img"
import pluginIcons from "eleventy-plugin-icons"
import {
getAllPosts,
getCategoryList,
getCategorisedPosts,
} from "./config/collections.js"
import { readableDate } from "./config/filters.js"
const imageConfig = {
extensions: "html",
formats: ["webp"],
widths: [300, 600, 900, "auto"],
defaultAttributes: {
loading: "lazy",
decoding: "async",
sizes: "100vw",
},
urlPath: "/images/",
}
export default function (eleventyConfig) {
/*================================*/
/* plugins and configurations */
/*================================*/
eleventyConfig.addPlugin(eleventyNavigationPlugin)
eleventyConfig.addPlugin(pluginRss)
eleventyConfig.addPlugin(eleventyImageTransformPlugin, imageConfig)
eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
excerpt_separator: "<!-- excerpt -->",
excerpt_alias: "excerpt",
})
eleventyConfig.addPlugin(pluginIcons, {
sources: [{ name: "custom", path: "./src/assets/icons" }],
})
/*===================================================*/
/* files that need to be copied to the build folder */
/*===================================================*/
eleventyConfig.addPassthroughCopy("./src/assets/social-image.jpg")
eleventyConfig.addPassthroughCopy("./src/assets/icons")
eleventyConfig.addPassthroughCopy("./src/assets/sprite.svg")
/*=================*/
/* Layouts */
/*=================*/
eleventyConfig.addLayoutAlias("page", "layouts/page")
eleventyConfig.addLayoutAlias("article", "layouts/article")
/*=================*/
/* Collections */
/*=================*/
eleventyConfig.addCollection("blog", getAllPosts)
eleventyConfig.addCollection("categoryList", getCategoryList)
eleventyConfig.addCollection("categorisedPosts", getCategorisedPosts)
/*=================*/
/* Filters */
/*=================*/
eleventyConfig.addFilter("readableDate", readableDate)
return {
dir: {
input: "src",
output: "_site",
includes: "_includes",
data: "_data",
},
markdownTemplateEngine: "njk",
};
}