-
Notifications
You must be signed in to change notification settings - Fork 14
/
eleventy.config.js
98 lines (91 loc) · 2.83 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
const process = require('node:process')
const rssPlugin = require('@11ty/eleventy-plugin-rss')
module.exports = function (eleventyConfig) {
// Plugins
eleventyConfig.addPlugin(rssPlugin)
eleventyConfig.addPlugin(require('./index.js'), {
icons: {
mask: 'https://raw.githubusercontent.com/x-govuk/logo/main/images/x-govuk-mask-icon.svg?raw=true',
shortcut:
'https://raw.githubusercontent.com/x-govuk/logo/main/images/x-govuk-favicon.ico',
touch:
'https://raw.githubusercontent.com/x-govuk/logo/main/images/x-govuk-apple-touch-icon.png'
},
opengraphImageUrl:
'https://x-govuk.github.io/govuk-eleventy-plugin/assets/opengraph-image.png',
homeKey: 'GOV.UK Eleventy Plugin',
titleSuffix: 'GOV.UK Eleventy Plugin',
parentSite: {
url: 'https://x-govuk.github.io/#projects',
name: 'X-GOVUK projects'
},
url:
process.env.GITHUB_ACTIONS &&
'https://x-govuk.github.io/govuk-eleventy-plugin/',
stylesheets: ['/assets/application.css'],
header: {
logotype: 'x-govuk',
productName: 'Eleventy Plugin',
search: {
indexPath: '/search.json',
sitemapPath: '/sitemap'
}
},
headingPermalinks: true,
footer: {
contentLicence: {
html: 'Licensed under the <a class="govuk-footer__link" href="https://github.com/x-govuk/govuk-eleventy-plugin/blob/main/LICENSE.txt">MIT Licence</a>, except where otherwise stated'
},
copyright: {
text: '© X-GOVUK'
},
meta: {
items: [
{
href: 'https://www.11ty.dev',
text: 'Documentation for Eleventy (opens in a new tab)',
attributes: {
target: '_blank'
}
}
]
}
}
})
// Collections
eleventyConfig.addCollection('layout', (collection) =>
collection
.getFilteredByGlob(['docs/layouts/*.md'])
.sort((a, b) => (a.data.order || 0) - (b.data.order || 0))
)
eleventyConfig.addCollection('homepage', (collection) =>
collection
.getFilteredByGlob([
'docs/options.md',
'docs/design.md',
'docs/layouts.md'
])
.sort((a, b) => (a.data.order || 0) - (b.data.order || 0))
)
eleventyConfig.addCollection('upgrading', (collection) =>
collection
.getFilteredByGlob(['docs/upgrading/*.md'])
.sort((a, b) => (a.data.order || 0) - (b.data.order || 0))
)
// Passthrough
eleventyConfig.addPassthroughCopy('./docs/assets')
// Watch
eleventyConfig.addWatchTarget('./components/')
eleventyConfig.addWatchTarget('./lib/')
// Config
return {
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
dir: {
input: 'docs',
layouts: '../layouts'
},
pathPrefix: process.env.GITHUB_ACTIONS && '/govuk-eleventy-plugin/'
}
}