-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy patheleventy.config.js
84 lines (75 loc) · 2.68 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
const govukEleventyPlugin = require('@x-govuk/govuk-eleventy-plugin')
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const { DateTime } = require("luxon");
module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy({ "app/assets/": "assets/"});
eleventyConfig.addPassthroughCopy({ "CNAME": "CNAME"});
eleventyConfig.addPassthroughCopy({ ".nojekyll": ".nojekyll"});
let govukPluginOptions = {
scssSettingsPath: "/css/_settings.scss",
header: {
organisationName: 'HM Revenue & Customs',
productName: 'Engineering Guidance',
logotype: {
html:
'<span class="govuk-header__logotype">' +
' <img src="/assets/hmrc_crest_18px_x2.png" height="34px" alt="HM Revenue & Customs logo">' +
' <span class="govuk-header__logotype-text">HM Revenue & Customs</span>' +
'</span>'
},
search: {
indexPath: '/search.json',
sitemapPath: '/sitemap.html'
}
},
footer: {
copyright: {
html: '© <a class="govuk-footer__link govuk-footer__copyright-logo" href="https://github.com/hmrc/engineering-site-spike/LICENCE">Crown copyright (HM Revenue & Customs)</a>'
},
meta: {
items: [
{
href: '/cookies/',
text: 'Cookies'
},
{
href: '/accessibility-statement/',
text: 'Accessibility statement'
},
{
href: 'https://github.com/hmrc/hmrc.github.io',
text: 'Github repository'
}
]
}
},
stylesheets: ['/css/base.css'],
}
eleventyConfig.addFilter("postDate", (dateObj) => {
return DateTime.fromJSDate(dateObj).toFormat('d MMMM yyyy');
});
// Register the plugin
eleventyConfig.addPlugin(govukEleventyPlugin, govukPluginOptions)
eleventyConfig.addCollection("getAllEngineeringPrinciplesOrderedByID", function(collectionApi) {
return collectionApi.getFilteredByGlob("**/engineering-principles/*.md").sort(function(a, b) {
return a.data.id - b.data.id; // sort by ID ascending
})
});
eleventyConfig.addCollection("getAllStandardsByName", function(collectionApi) {
return collectionApi.getFilteredByGlob("**/standards/*.md").sort(function(a, b) {
return a.data.title.localeCompare(b.data.title); // sort by title ascending
});
});
eleventyConfig.addPlugin(eleventyNavigationPlugin);
return {
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
dir: {
input: 'app',
output: 'dist',
// Use layouts from the plugin
layouts: '../node_modules/@x-govuk/govuk-eleventy-plugin/layouts'
}
}
};