-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy patheleventy.config.js
More file actions
79 lines (62 loc) · 2.17 KB
/
Copy patheleventy.config.js
File metadata and controls
79 lines (62 loc) · 2.17 KB
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
import { HtmlBasePlugin } from '@11ty/eleventy';
import { resolve } from 'node:path';
import debug from 'debug';
import diaPluginLoader, { loadEnvJs } from 'dia-plugins';
import togglePopoverShortcode from 'eleventy-plugin-popover';
// GitHub Pages sub-directory deployment.
const baseHref = '/diveintoaccessibility/';
/**
* Configure Eleventy
*
* @see https://www.11ty.dev/docs/config/
*/
export default async function (eleventyConfig) {
const debugLog = debug('DIA:config');
debugLog('Loading config…');
await loadEnvJs([import.meta.dirname, '.env.js']);
// Order matters, put this at the top of your configuration file.
eleventyConfig.setInputDirectory('pages');
eleventyConfig.setIncludesDirectory('../_includes');
// eleventyConfig.setLayoutsDirectory('../_includes/layouts');
eleventyConfig.addLayoutAlias('dia_outer_page', 'layouts/page.njk');
// @WAS: eleventyConfig.addLayoutAlias('page', 'layouts/page.njk');
// Set global permalinks to "resource.html" style.
eleventyConfig.addGlobalData('permalink', () => {
return (data) =>
`${data.page.filePathStem}.${data.page.outputFileExtension}`;
});
eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
// Optional, default is "---"
excerpt_separator: '<!-- excerpt -->',
});
// https://www.11ty.dev/docs/data-global-custom/
/* eleventyConfig.addGlobalData('pageID', () => {
return (data) => pageId.compute(data.page);
}); */
eleventyConfig.addPlugin(HtmlBasePlugin, { baseHref }); // eleventyConfig.pathPrefix,
eleventyConfig.addPlugin(diaPluginLoader, {
linkFiles: getLinkFilePaths(),
buildBaseUrl: baseHref
});
eleventyConfig.addPlugin(togglePopoverShortcode);
eleventyConfig.addPassthroughCopy('download/*');
eleventyConfig.addPassthroughCopy('examples/*');
eleventyConfig.addPassthroughCopy('images/*');
}
function getLinkFilePaths () {
return [
resolve('pages', 'links', 'internal.md'),
resolve('pages', 'links', 'external.md'),
resolve('pages', 'links', 'translation_links.md'),
];
}
export const config = {
pathPrefix: baseHref,
};
/* export const config = {
dir: {
includes: '../_includes',
input: 'pages'
}
}; */