-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy patheleventy.config.js
More file actions
91 lines (83 loc) · 2.3 KB
/
Copy patheleventy.config.js
File metadata and controls
91 lines (83 loc) · 2.3 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
80
81
82
83
84
85
86
87
88
89
90
91
import fs from 'node:fs/promises'
import { govukEleventyPlugin } from '@x-govuk/govuk-eleventy-plugin'
const serviceName = 'X-GOVUK'
export default function (eleventyConfig) {
eleventyConfig.addPlugin(govukEleventyPlugin, {
footer: {
meta: {
items: [
{
href: '/feed.xml',
text: 'Subscribe to feed'
}
]
},
contentLicence: {
html: 'An unofficial community project. <a class="govuk-footer__link" href="https://github.com/x-govuk/x-govuk.github.io">GitHub source</a>.'
},
copyright: {
text: '© X-GOVUK'
}
},
homeKey: serviceName,
icons: {
mask: 'https://raw.githubusercontent.com/x-govuk/logo/main/images/x-govuk-icon-mask.svg?raw=true',
shortcut:
'https://raw.githubusercontent.com/x-govuk/logo/main/images/favicon.ico',
touch:
'https://raw.githubusercontent.com/x-govuk/logo/main/images/x-govuk-icon-180.png'
},
opengraphImageUrl:
'https://raw.githubusercontent.com/x-govuk/logo/main/images/x-govuk-opengraph-image.png',
serviceNavigation: {
navigation: [
{
text: 'Home',
href: '/'
},
{
text: 'Community projects',
href: '/projects'
},
{
text: 'Posts',
href: '/posts'
}
]
},
showBreadcrumbs: false,
stylesheets: ['/assets/application.css'],
templates: {
feed: true
},
themeColor: '#2288aa',
titleSuffix: serviceName,
url: process.env.GITHUB_ACTIONS && 'https://x-govuk.org/'
})
// Collections
eleventyConfig.addCollection('post', (collection) => {
return collection.getFilteredByGlob('app/posts/*.md')
})
// Pass through
eleventyConfig.addPassthroughCopy('./app/assets')
// Enable X-GOVUK brand
eleventyConfig.addNunjucksGlobal('xGovuk', true)
// Reset contents of output directory before each build
eleventyConfig.on('eleventy.before', async ({ directories, runMode }) => {
if (runMode === 'build') {
await fs.rm(directories.output, {
force: true,
recursive: true
})
}
})
return {
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
dir: {
input: 'app',
layouts: '_layouts'
}
}
}