Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .eleventy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
module.exports = function(eleventyConfig) {
eleventyConfig.addPassthroughCopy({'web/dist/fonts': "fonts"})
eleventyConfig.addPassthroughCopy({'web/dist/images': "images"})
eleventyConfig.addPassthroughCopy({'web/dist/js': "js"})
eleventyConfig.addPassthroughCopy({'web/dist/styles': "styles"})
eleventyConfig.addPassthroughCopy({'web/dist/svg': "svg"})

// Enable custom order in site navigation
eleventyConfig.addCollection("navItems", function (collection) {
return collection.getAll().filter((item) => item.data.navItem)
.sort((a, b) => b.data.navOrder - a.data.navOrder);
})

// Inject nunjucks macro import for components into top level Markdown files
eleventyConfig.addCollection('rootfiles', function (collection) {
const macroImport = `{% from "./_includes/system/components.njk" import pageComponents %}`;
let topLevelCollection = collection.getAll().filter((item) => item.data.root);

topLevelCollection.forEach((item) => {
item.template.frontMatter.content = `${macroImport}\n${item.template.frontMatter.content}`;
})

return topLevelCollection;
})

// Inject nunjucks macro import for components in section-specific Markdown files
eleventyConfig.addCollection('subpages', function (collection) {
const macroImport = `{% from "../_includes/system/components.njk" import pageComponents %}`;
let subPageCollection = collection.getAll().filter((item) => item.data.subpage);

subPageCollection.forEach((item) => {
item.template.frontMatter.content = `${macroImport}\n${item.template.frontMatter.content}`;
})

return subPageCollection;
})
return {
passthroughFileCopy: true,
markdownTemplateEngine: "njk",
dir: {
input: "web/amplify/eleventy",
output: "web/eleventy-dist",
layout: "templates/page.njk"
}
}
}
Loading