summaryrefslogtreecommitdiff
path: root/eleventy.config.mjs
blob: 2e679a3393e6be8e2c324517c87bf78b1c47eb85 (plain) (blame)
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
import { parseISO , format} from "date-fns";
import { config as siteConfig } from "./siteconfig.mjs";
import { eleventyImageTransformPlugin } from "@11ty/eleventy-img";


export default function(eleventyConfig) {
	// Order matters, put this at the top of your configuration file.

  eleventyConfig.addNunjucksFilter("date", (dateObj, formatString = 'MM.dd.yyyy') => format(dateObj, formatString))

  eleventyConfig.addCollection("navItems", function (collectionsApi) {
		return collectionsApi.getAll().filter(i =>  {
      if (i.data.nav) {
        return i.data.nav > 0
      }
    }).sort(function (a, b) {
			return (a.data.nav ?? -1000) - (b.data.nav ?? -1000);
		});
	});

  eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
    widths: [200, "auto"],
    htmlOptions: {
			imgAttributes: {
				loading: "lazy",
				decoding: "async",
			},
			pictureAttributes: {}
		},
  });

  eleventyConfig.addBundle("css", {
    toFileDirectory: "assets/css/bundles/",

		// (Optional) File extension used for bundle file output, defaults to bundle name
		outputFileExtension: "css",
  });

  eleventyConfig.addBundle("js", {
    toFileDirectory: "assets/js/bundles/",

		// (Optional) File extension used for bundle file output, defaults to bundle name
		outputFileExtension: "js",
  });

  eleventyConfig.addGlobalData("layout","page");
  eleventyConfig.addGlobalData("site", {
    title: siteConfig.siteTitle ?? "Site",
    headerLinks: siteConfig.headerLinks ?? [],
    footerLinks: siteConfig.footerLinks ?? []
  })

  eleventyConfig
		.addPassthroughCopy({"./public/": "/"})
		.addPassthroughCopy({"./assets/": "/assets"})

};
export const config = {
  dir: {
    input: "content",
    output: "_dist",
    includes: "../_includes",
    layouts: "../_layouts",
  },
  templateFormats: ["md", "njk"],
  htmlTemplateEngine: "njk",
  markdownTemplateEngine: "njk"
};