@@ -19,12 +19,12 @@ const {
19
19
20
20
const media_filetypes = "jpg,jpeg,JPG,png,gif,svg,avif" ;
21
21
22
- module . exports = function ( eleventyConfig ) {
22
+ module . exports = function ( eleventyConfig ) {
23
23
// Configure markdown parser
24
- const markdownLib = markdownIt ( { html : true , typographer : true } ) ;
24
+ const markdownLib = markdownIt ( { html : true , typographer : true } ) ;
25
25
markdownLib . use ( markdownItAnchor ) ;
26
26
markdownLib . use ( markdownItAttrs ) ;
27
-
27
+
28
28
eleventyConfig . setLibrary ( "md" , markdownLib ) ;
29
29
eleventyConfig . addPlugin ( fortawesomeBrandsPlugin ) ;
30
30
eleventyConfig . addPlugin ( syntaxHighlight ) ;
@@ -38,8 +38,8 @@ module.exports = function(eleventyConfig) {
38
38
eleventyConfig . addPassthroughCopy ( "favicon.png" ) ;
39
39
eleventyConfig . addPassthroughCopy ( "galleries/**/*." + media_filetypes ) ;
40
40
eleventyConfig . addPassthroughCopy ( "google5458abc1104b04dd.html" ) ;
41
- eleventyConfig . addPassthroughCopy ( { "htaccess" : ".htaccess" } ) ;
42
- eleventyConfig . addPassthroughCopy ( { "content" : "." } , {
41
+ eleventyConfig . addPassthroughCopy ( { "htaccess" : ".htaccess" } ) ;
42
+ eleventyConfig . addPassthroughCopy ( { "content" : "." } , {
43
43
filter : [ "**/*." + + media_filetypes ] ,
44
44
rename : function ( path ) {
45
45
return path . replace ( "content/" , "" ) ;
@@ -49,7 +49,7 @@ module.exports = function(eleventyConfig) {
49
49
eleventyConfig . addWatchTarget ( "src/**/*" ) ;
50
50
let $collectionApi = null ;
51
51
52
- eleventyConfig . addCollection ( "posts" , function ( collectionApi ) {
52
+ eleventyConfig . addCollection ( "posts" , function ( collectionApi ) {
53
53
$collectionApi = collectionApi ;
54
54
return collectionApi . getFilteredByGlob ( "_posts/*.md" ) ;
55
55
} ) ;
@@ -58,55 +58,55 @@ module.exports = function(eleventyConfig) {
58
58
dynamicPartials : false ,
59
59
} ) ;
60
60
61
- eleventyConfig . addFilter ( "cssmin" , function ( code ) {
61
+ eleventyConfig . addFilter ( "cssmin" , function ( code ) {
62
62
return new CleanCSS ( { } ) . minify ( code ) . styles ;
63
63
} ) ;
64
64
65
- eleventyConfig . addShortcode ( "image" , async function ( src , alt , sizes ) {
65
+ eleventyConfig . addShortcode ( "image" , async function ( src , alt , sizes ) {
66
66
let metadata = await fetch_image ( src ) ;
67
67
68
- let imageAttributes = {
69
- alt,
70
- sizes,
71
- loading : "lazy" ,
72
- decoding : "async" ,
73
- } ;
68
+ let imageAttributes = {
69
+ alt,
70
+ sizes,
71
+ loading : "lazy" ,
72
+ decoding : "async" ,
73
+ } ;
74
74
75
- // You bet we throw an error on a missing alt (alt="" works okay)
76
- return Image . generateHTML ( metadata , imageAttributes ) ;
77
- } ) ;
75
+ // You bet we throw an error on a missing alt (alt="" works okay)
76
+ return Image . generateHTML ( metadata , imageAttributes ) ;
77
+ } ) ;
78
78
79
- eleventyConfig . addShortcode ( "img_responsive" , async function ( src , alt , sizes = "100vw, 720, 820, 940, 1140, 1280" ) {
79
+ eleventyConfig . addShortcode ( "img_responsive" , async function ( src , alt , sizes = "100vw, 720, 820, 940, 1140, 1280" ) {
80
80
let metadata = await fetch_image ( src ) ;
81
- let imageAttributes = {
82
- alt,
83
- sizes,
81
+ let imageAttributes = {
82
+ alt,
83
+ sizes,
84
84
class : "img-responsive" ,
85
- loading : "lazy" ,
86
- decoding : "async" ,
87
- } ;
85
+ loading : "lazy" ,
86
+ decoding : "async" ,
87
+ } ;
88
88
89
- return Image . generateHTML ( metadata , imageAttributes ) ;
89
+ return Image . generateHTML ( metadata , imageAttributes ) ;
90
90
} ) ;
91
91
92
- eleventyConfig . addShortcode ( "image_with_class" , async function ( src , alt , sizes , class_names ) {
92
+ eleventyConfig . addShortcode ( "image_with_class" , async function ( src , alt , sizes , class_names ) {
93
93
let metadata = await fetch_image ( src ) ;
94
94
95
- if ( sizes == undefined || sizes == "_" ) {
96
- sizes = "720, 940, 1140, 1280, 2048" ;
95
+ if ( sizes == undefined || sizes == "_" ) {
96
+ sizes = "720, 940, 1140, 1280, 2048" ;
97
97
}
98
98
99
- let imageAttributes = {
100
- alt,
101
- sizes,
99
+ let imageAttributes = {
100
+ alt,
101
+ sizes,
102
102
class : class_names ,
103
- loading : "lazy" ,
104
- decoding : "async" ,
105
- } ;
103
+ loading : "lazy" ,
104
+ decoding : "async" ,
105
+ } ;
106
106
107
- // You bet we throw an error on a missing alt (alt="" works okay)
108
- return Image . generateHTML ( metadata , imageAttributes ) ;
109
- } ) ;
107
+ // You bet we throw an error on a missing alt (alt="" works okay)
108
+ return Image . generateHTML ( metadata , imageAttributes ) ;
109
+ } ) ;
110
110
111
111
// Thumbnails
112
112
eleventyConfig . addShortcode ( "thumbnail_for_post" , thumbnails . thumbnail_for_post ) ;
@@ -124,15 +124,15 @@ module.exports = function(eleventyConfig) {
124
124
} ) ;
125
125
126
126
// Liquid filter to convert a date to a string
127
- eleventyConfig . addLiquidFilter ( "to_utc_string" , date => date . toUTCString ( ) ) ;
127
+ eleventyConfig . addLiquidFilter ( "to_utc_string" , date => date . toUTCString ( ) ) ;
128
128
129
129
// Liquid filter for long date string
130
- eleventyConfig . addLiquidFilter ( "date_to_long_string" , function ( date ) {
130
+ eleventyConfig . addLiquidFilter ( "date_to_long_string" , function ( date ) {
131
131
return date . toLocaleDateString ( "en-GB" , { weekday : 'long' , year : 'numeric' , month : 'long' , day : 'numeric' } ) ;
132
132
} ) ;
133
133
134
134
// Universal filter for jsonify
135
- eleventyConfig . addFilter ( "jsonify" , JSON . stringify ) ;
135
+ eleventyConfig . addFilter ( "jsonify" , JSON . stringify ) ;
136
136
137
137
eleventyConfig . addFilter ( "with_explicit_date" , items => items . filter ( item => "date" in item . data ) ) ;
138
138
@@ -142,14 +142,14 @@ module.exports = function(eleventyConfig) {
142
142
143
143
// Read the menu data from _config.yml and add it to the global data
144
144
eleventyConfig . addGlobalData ( "menu" , ( ) => getDataFromConfigYaml ( "menu" ) ) ;
145
- eleventyConfig . addGlobalData ( "site_title" , ( ) => getDataFromConfigYaml ( "title" ) ) ;
146
- eleventyConfig . addGlobalData ( "site_tagline" , ( ) => getDataFromConfigYaml ( "tagline" ) ) ;
147
- eleventyConfig . addGlobalData ( "production_url" , ( ) => getDataFromConfigYaml ( "production_url" ) ) ;
148
- eleventyConfig . addGlobalData ( "JB" , ( ) => getDataFromConfigYaml ( "JB" ) ) ;
149
- eleventyConfig . addGlobalData ( "author" , ( ) => getDataFromConfigYaml ( "author" ) ) ;
150
- eleventyConfig . addGlobalData ( "now" , ( ) => new Date ( ) ) ;
151
-
152
- eleventyConfig . addNunjucksFilter ( "date" , function ( date , format ) {
145
+ eleventyConfig . addGlobalData ( "site_title" , ( ) => getDataFromConfigYaml ( "title" ) ) ;
146
+ eleventyConfig . addGlobalData ( "site_tagline" , ( ) => getDataFromConfigYaml ( "tagline" ) ) ;
147
+ eleventyConfig . addGlobalData ( "production_url" , ( ) => getDataFromConfigYaml ( "production_url" ) ) ;
148
+ eleventyConfig . addGlobalData ( "JB" , ( ) => getDataFromConfigYaml ( "JB" ) ) ;
149
+ eleventyConfig . addGlobalData ( "author" , ( ) => getDataFromConfigYaml ( "author" ) ) ;
150
+ eleventyConfig . addGlobalData ( "now" , ( ) => new Date ( ) ) ;
151
+
152
+ eleventyConfig . addNunjucksFilter ( "date" , function ( date , format ) {
153
153
return moment ( date ) . format ( format ) ;
154
154
} ) ;
155
155
0 commit comments