-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
69 lines (56 loc) · 2.46 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
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const i18n = require('eleventy-plugin-i18n');
const translations = require('./src/_data/translations');
const { fortawesomeFreeRegularPlugin } = require('@vidhill/fortawesome-free-regular-11ty-shortcode');
const { fortawesomeBrandsPlugin } = require('@vidhill/fortawesome-brands-11ty-shortcode');
module.exports = (config) => {
config.addWatchTarget("./src/assets/scss/");
config.addTransform("minify", require("./src/_11ty/transforms/minify"));
config.addPassthroughCopy('./src/admin/');
config.addPassthroughCopy('./src/_redirects');
config.addPassthroughCopy('./src/assets/brand/');
// Filters
config.addFilter('localeFilter', require('./src/_11ty/filters/localeFilter'));
config.addFilter('productTypeFilter', require('./src/_11ty/filters/productTypeFilter'));
// Shortcodes
config.addNunjucksShortcode('image', require('./src/_11ty/shortcodes/imageShortcode'));
// Plugin
config.addPlugin(eleventyNavigationPlugin);
config.addPlugin(i18n, translations);
config.addPlugin(fortawesomeFreeRegularPlugin);
config.addPlugin(fortawesomeBrandsPlugin);
const sortAlphabetically = require('./src/_11ty/utils/sort-alphabetically.js');
// Returns plastic categories in english
config.addCollection('packagingCategory_en', collection => {
return collection.getFilteredByGlob('./src/content/en/packaging/*.md');
});
// Returns plastic categories in french
config.addCollection('packagingCategory_fr', collection => {
return collection.getFilteredByGlob('./src/content/fr/packaging/*.md');
});
// Returns equipment categories in english
config.addCollection('equipmentCategory_en', collection => {
return collection.getFilteredByGlob('./src/equipment/productCategory/en/*.md');
});
// Returns equipment categories in french
config.addCollection('equipmentCategory_fr', collection => {
return collection.getFilteredByGlob('./src/equipment/productCategory/fr/*.md');
});
// Returns equipments in english
config.addCollection('equipment_en', collection => {
return sortAlphabetically(collection.getFilteredByGlob('./src/equipment/products/en/*.md'))
});
// Returns equipments in french
config.addCollection('equipment_fr', collection => {
return sortAlphabetically(collection.getFilteredByGlob('./src/equipment/products/fr/*.md'))
});
return {
markdownTemplateEngine: "njk",
dataTemplateEngine: "njk",
htmlTemplateEngine: "njk",
dir: {
input: "src",
output: "public",
},
};
};