-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheleventy.config.js
68 lines (60 loc) · 2.13 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
const isCi = require('is-ci');
const markdownIt = require('markdown-it');
const markdownItAnchor = require('markdown-it-anchor');
const EleventySassPlugin = require('eleventy-sass');
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
const EleventySyntaxHighlightPlugin = require('@11ty/eleventy-plugin-syntaxhighlight');
const EleventyNavigationPlugin = require('@11ty/eleventy-navigation');
const pathPrefix = isCi ? '/gobstones-guidelines' : '';
module.exports = function (el) {
/*
* Copy your _assets elements directly to a subfolder or
* file in the output. You may add more files if required.
*/
el.addPassthroughCopy('src/assets/css');
el.addPassthroughCopy('src/assets/js');
el.addPassthroughCopy('src/assets/img');
el.addPassthroughCopy('src/favicon.ico');
/*
* Add plugins.
* Add yours at the bottom if needed.
*/
el.addPlugin(EleventySassPlugin);
el.addPlugin(EleventySyntaxHighlightPlugin);
el.addPlugin(EleventyNavigationPlugin);
el.addPlugin(EleventyHtmlBasePlugin);
/*
* Set the markdown library to use, use a custom instance to
* allow the addition of markdown-it-anchor plugin
*/
el.setLibrary('md',
markdownIt({ html: true })
.use(markdownItAnchor, {
permalink: markdownItAnchor.permalink.linkAfterHeader({
class: 'anchor',
assistiveText: title => `Permalink to “${title}”`,
visuallyHiddenClass: 'hidden'
})
})
);
/*
* Set global data that will be used by all pages, as to avoid
* having to repeat it in every front matter
*/
el.addGlobalData('layout', 'doc');
el.addGlobalData('navOptions', {
includeSelf: true, allowMissing: true
});
el.addGlobalData("permalink", () => {
return (data) => `${data.page.filePathStem.replace('pages/', '')}.${data.page.outputFileExtension}`;
});
return {
dir: {
input: 'src',
output: 'dist',
includes: 'templates/includes',
layouts: 'templates/layouts',
},
pathPrefix: pathPrefix,
};
};