-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy patheleventy.config.js
More file actions
103 lines (93 loc) · 3.13 KB
/
eleventy.config.js
File metadata and controls
103 lines (93 loc) · 3.13 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
92
93
94
95
96
97
98
99
100
101
102
103
import process from 'node:process'
import { govukEleventyPlugin } from '@x-govuk/govuk-eleventy-plugin'
function getStyleSheets() {
let it = ['/assets/application.css'];
if (process.env.GITHUB_ACTIONS) {
it.push('/assets/github.css');
}
return it
}
export default function (eleventyConfig) {
eleventyConfig.addPassthroughCopy({
'node_modules/@hmlr/frontend/hmlr/assets': 'hmlrassets',
'app/assets': 'assets',
'app/schemas': 'schemas',
'node_modules/@govuk-prototype-kit/step-by-step/javascripts': 'assets/js'
})
eleventyConfig.addPlugin(govukEleventyPlugin, {
icons: {
mask: "/hmlrassets/images/mask-icon.svg",
shortcut: "/hmlrassets/images/favicon.ico",
touch: "/hmlrassets/images/apple-touch-icon.png"
},
showBreadcrumbs: false,
opengraphImageUrl: "/hmlrassets/images/hmlr-opengraph-image.png",
themeColor: '#789904',
// rebrand: true,
stylesheets: getStyleSheets(),
titleSuffix: "HM Land Registry Developer Pack",
header: {
logotype: {text: "HM Land Registry Developer Pack"},
productType: "",
search: {
label: "Search developer pack",
indexPath: `${process.env.GITHUB_ACTIONS ? '/bg-dev-pack-redesign' : ''}/search-index.json`,
sitemapPath: `${process.env.GITHUB_ACTIONS ? '/bg-dev-pack-redesign' : ''}/sitemap`
}
},
serviceNavigation: true,
footer: {
logo: false,
// copyright: {
// text: "© HM Land Registry"
// }
},
templates: {
searchIndex: true,
sitemap: true
}
})
eleventyConfig.addCollection('Explore APIs', collection =>
collection.getFilteredByGlob([
'/api/*.md'
]).sort((a, b) => (a.data.order || 0) - (b.data.order || 0))
)
eleventyConfig.addCollection('Support', collection =>
collection.getFilteredByGlob([
'/support/*.md'
]).sort((a, b) => (a.data.order || 0) - (b.data.order || 0))
)
// eleventyConfig.addFilter("withOriginalDomain", function (path) {
// const domain = process.env.SITE_ORIGINAL_DOMAIN || "https://landregistry.github.io/bgtechdoc/";
// return `${domain}${path}`;
// });
if(!process.env.GITHUB_ACTIONS){
eleventyConfig.addPlugin( eleventyConfig => {
eleventyConfig.addTransform("rewrite-original-domain", async function (content) {
const domainOverride = "https://integration-customer-documentation-bg-int-priv.apps.development.test.stp.hmlr.zone/";
return content.replaceAll("https://landregistry.github.io/bgtechdoc/", domainOverride);
});
})
}
return {
dataTemplateEngine: 'njk',
htmlTemplateEngine: 'njk',
markdownTemplateEngine: 'njk',
dir: {
// The folder where all your content will live:
input: 'app',
includes: '_includes',
output: '_site'
},
nunjucksEnvironmentOptions: {
paths: [
"./_includes",
"../node_modules/@hmlr/frontend",
"node_modules/govuk-frontend/dist",
"node_modules/govuk-frontend/dist/govuk",
"node_modules/govuk-frontend/dist/govuk/components"
],
},
pathPrefix: process.env.GITHUB_ACTIONS ? '/bg-dev-pack-redesign/' : '/',
}
};