Skip to content

Commit fb43091

Browse files
authored
Merge pull request #51 from stebrech/v3.1.0
see release notes
2 parents 86badf2 + 4289c7a commit fb43091

File tree

110 files changed

+4238
-2484
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+4238
-2484
lines changed

.gitignore

Lines changed: 9 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,25 @@
22
logs
33
*.log
44
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
75

8-
# Runtime data
9-
pids
10-
*.pid
11-
*.seed
12-
*.pid.lock
13-
14-
# Directory for instrumented libs generated by jscoverage/JSCover
15-
lib-cov
16-
17-
# Coverage directory used by tools like istanbul
18-
coverage
19-
20-
# nyc test coverage
21-
.nyc_output
22-
23-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24-
.grunt
25-
26-
# Bower dependency directory (https://bower.io/)
27-
bower_components
28-
29-
# node-waf configuration
30-
.lock-wscript
31-
32-
# Compiled binary addons (http://nodejs.org/api/addons.html)
33-
build/Release
34-
35-
# Dependency directories
6+
# Dependency directory
367
node_modules/
37-
jspm_packages/
38-
39-
# Typescript v1 declaration files
40-
typings/
418

42-
# Optional npm cache directory
9+
# Cache
4310
.npm
44-
45-
# Optional eslint cache
46-
.eslintcache
47-
48-
# Optional REPL history
49-
.node_repl_history
50-
51-
# Output of 'npm pack'
52-
*.tgz
11+
.cache/
5312

5413
# dotenv environment variable files
5514
.env*
5615

57-
# gatsby files
58-
.cache/
59-
public
16+
# build output
17+
_site
6018

6119
# Mac files
6220
.DS_Store
6321

64-
# Yarn
65-
yarn-error.log
66-
.pnp/
67-
.pnp.js
68-
# Yarn Integrity file
69-
.yarn-integrity
22+
# Obsidian vault files
23+
.obsidian
7024

71-
# Temp files
72-
temp
25+
# Local temp files
26+
tmp

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"editor.tabSize": 2,
33
"editor.insertSpaces": false,
44
"prettier.useTabs": true,
5-
"editor.formatOnSave": true
5+
"editor.formatOnSave": true,
6+
"markdown.extension.toc.updateOnSave": false
67
}

eleventy.config.filters.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module.exports = (eleventyConfig) => {
44
eleventyConfig.addFilter("localizedDate", (dateObj, lang, format) => {
55
// Formatting tokens for Luxon: https://moment.github.io/luxon/#/formatting?id=table-of-tokens
66
return DateTime.fromJSDate(dateObj, { locale: lang || "en" }).toFormat(
7-
format || "LLLL dd yyyy"
7+
format || "LLLL dd yyyy",
88
);
99
});
1010

@@ -17,7 +17,12 @@ module.exports = (eleventyConfig) => {
1717
return values.slice().sort((a, b) => a.data.title.localeCompare(b.data.title));
1818
});
1919

20-
eleventyConfig.addFilter("sortByMenuOrder", (values) => {
21-
return values.slice().sort((a, b) => a.data.order - b.data.order);
20+
eleventyConfig.addFilter("sortByOrder", (values) => {
21+
return values.slice().sort((a, b) => {
22+
if (a.data.order && b.data.order) {
23+
return a.data.order - b.data.order;
24+
}
25+
return 0;
26+
});
2227
});
2328
};

eleventy.config.images.js

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,71 @@
11
const path = require("path");
22
const eleventyImage = require("@11ty/eleventy-img");
3+
const markdownIt = require("markdown-it");
4+
const markdownItEleventyImg = require("markdown-it-eleventy-img");
35

46
module.exports = (eleventyConfig) => {
7+
const defaultImageWidths = [1210, 1044, 800, 400];
8+
const defaultImageFormats = ["webp", "auto"];
9+
const defaultImageSizes = "100vw";
10+
511
// Eleventy Image shortcode
612
// https://www.11ty.dev/docs/plugins/image/
713
eleventyConfig.addAsyncShortcode("image", async function imageShortcode(src, alt, widths, sizes) {
814
// Full list of formats here: https://www.11ty.dev/docs/plugins/image/#output-formats
915
// Warning: Avif can be resource-intensive so take care!
10-
let formats = ["webp", "auto"];
1116
let metadata = await eleventyImage(src, {
12-
widths: widths || [1210, 1044, 800, 400],
13-
formats,
17+
widths: widths || defaultImageWidths,
18+
formats: defaultImageFormats,
1419
urlPath: "/assets/img/",
1520
outputDir: path.join(eleventyConfig.dir.output, "/assets/img/"),
21+
filenameFormat: function (id, src, width, format, options) {
22+
// id: hash of the original image
23+
// src: original image path
24+
// width: current width in px
25+
// format: current file format
26+
// options: set of options passed to the Image call
27+
const filename = path.basename(src, path.extname(src));
28+
return `${filename}_${width}.${format}`;
29+
},
1630
});
1731

1832
// TODO loading=eager and fetchpriority=high
1933
let imageAttributes = {
2034
alt,
21-
sizes: sizes || "100vw",
35+
sizes: sizes || defaultImageSizes,
2236
loading: "lazy",
2337
decoding: "async",
2438
};
2539
return eleventyImage.generateHTML(metadata, imageAttributes);
2640
});
41+
42+
eleventyConfig.setLibrary(
43+
"md",
44+
markdownIt({ html: true, breaks: true }).use(markdownItEleventyImg, {
45+
imgOptions: {
46+
widths: defaultImageWidths,
47+
formats: defaultImageFormats,
48+
urlPath: "/assets/img/",
49+
outputDir: path.join(eleventyConfig.dir.output, "/assets/img/"),
50+
sharpOptions: {
51+
animated: true,
52+
limitInputPixels: false,
53+
},
54+
filenameFormat: function (id, src, width, format, options) {
55+
// id: hash of the original image
56+
// src: original image path
57+
// width: current width in px
58+
// format: current file format
59+
// options: set of options passed to the Image call
60+
const filename = path.basename(src, path.extname(src));
61+
return `${filename}_${width}.${format}`;
62+
},
63+
},
64+
globalAttributes: {
65+
class: "markdown-img",
66+
decoding: "async",
67+
sizes: defaultImageSizes,
68+
},
69+
}),
70+
);
2771
};

eleventy.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module.exports = function (eleventyConfig) {
99
eleventyConfig.addPassthroughCopy({
1010
"./src/assets/img/svg": "/assets/img",
1111
"./src/assets/styles": "/assets/styles",
12+
"./src/assets/js": "/assets/js",
1213
"./src/assets/favicons": "/",
1314
"./src/assets/manifest": "/",
1415
"./src/assets/robots.txt": "/robots.txt",
@@ -50,9 +51,9 @@ module.exports = function (eleventyConfig) {
5051

5152
dir: {
5253
input: "src/content", // default: "."
53-
includes: "../assets/layouts", // default: "_includes"
54+
includes: "../_templates", // default: "_includes"
5455
data: "../_data", // default: "_data"
55-
output: "public", // default: "_site
56+
output: "_site", // default: "_site
5657
},
5758
};
5859
};

eleventy.config.markdown.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,7 @@
1-
const markdownIt = require("markdown-it");
21
const markdownItAnchor = require("markdown-it-anchor");
3-
const markdownItEleventyImg = require("markdown-it-eleventy-img");
42
const pluginTOC = require("eleventy-plugin-toc");
5-
const path = require("path");
63

74
module.exports = function (eleventyConfig) {
8-
eleventyConfig.setLibrary(
9-
"md",
10-
markdownIt({ html: true })
11-
.use(markdownItAnchor)
12-
.use(markdownItEleventyImg, {
13-
imgOptions: {
14-
widths: [1210, 1044, 800, 400],
15-
urlPath: "/assets/img/",
16-
outputDir: path.join(eleventyConfig.dir.output, "/assets/img/"),
17-
formats: ["webp", "jpeg"],
18-
},
19-
globalAttributes: {
20-
class: "markdown-img",
21-
decoding: "async",
22-
// If you use multiple widths,
23-
// don't forget to add a `sizes` attribute.
24-
sizes: "100vw",
25-
},
26-
})
27-
);
28-
295
eleventyConfig.addPlugin(pluginTOC, {
306
ul: true,
317
wrapperClass: "glossary-toc",

netlify.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# tell netlify about your build script and output directory
22

33
[build]
4-
command = "yarn build"
5-
publish = "public"
4+
command = "npm run build"
5+
publish = "_site"
66

77

88
# redirect former English urls without lang prefix

0 commit comments

Comments
 (0)