Skip to content

Commit a029798

Browse files
committed
Update to latest version with Cloudflare Pages Support.
No longer have to submit the full _site_production thing.
1 parent d969ed5 commit a029798

File tree

1,424 files changed

+1317
-9753
lines changed

Some content is hidden

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

1,424 files changed

+1317
-9753
lines changed

.eleventy.js

+84-91
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
1-
const { DateTime } = require("luxon");
1+
const { DateTime } = require("luxon")
22
const readingTime = require('eleventy-plugin-reading-time')
33
const embedEverything = require("eleventy-plugin-embed-everything")
4-
const pluginRss = require("@11ty/eleventy-plugin-rss");
5-
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
6-
const markdownIt = require("markdown-it");
7-
const markdownItAnchor = require("markdown-it-anchor");
8-
const markdownItFootnote = require("markdown-it-footnote");
4+
const pluginRss = require("@11ty/eleventy-plugin-rss")
5+
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight")
6+
const markdownIt = require("markdown-it")
7+
const markdownItAnchor = require("markdown-it-anchor")
8+
const markdownItFootnote = require("markdown-it-footnote")
99
const markdownItContainer = require("markdown-it-container")
1010
const markdownItResponsive = require('@gerhobbelt/markdown-it-responsive')
1111

1212
const transforms = require('./utils/transforms.js')
1313
const filters = require('./utils/filters.js')
1414

1515
const now = new Date()
16-
const envLong = process.env.NODE_ENV
1716

1817
module.exports = (config) => {
19-
config.addPlugin(pluginRss);
20-
config.addPlugin(pluginSyntaxHighlight);
18+
config.addPlugin(pluginRss)
19+
config.addPlugin(pluginSyntaxHighlight)
2120
config.addPlugin(readingTime)
2221
config.addPlugin(embedEverything)
2322

2423
// Transforms
2524
Object.keys(transforms).forEach((transformName) => {
26-
config.addTransform(transformName, transforms[transformName]);
27-
});
25+
config.addTransform(transformName, transforms[transformName])
26+
})
2827

2928
// Filters
3029
Object.keys(filters).forEach((filterName) => {
31-
config.addFilter(filterName, filters[filterName]);
32-
});
30+
config.addFilter(filterName, filters[filterName])
31+
})
3332

3433
const isDraftOrIndex = (post) => {
3534
if (post.data.draft) return false
@@ -51,19 +50,15 @@ module.exports = (config) => {
5150
return true
5251
}
5352

54-
config.addPassthroughCopy("assets/favicon");
55-
config.addPassthroughCopy({ 'assets/chrisspiegl.asc': 'chrisspiegl.asc' });
53+
config.addPassthroughCopy("assets/favicon")
54+
config.addPassthroughCopy({ 'assets/chrisspiegl.asc': 'chrisspiegl.asc' })
5655

5756
config.addCollection('posts', collection => {
5857
return collection.getFilteredByGlob('./post/**/*.md').filter(_ => livePosts(_)).reverse()
5958
})
6059

6160
config.addCollection('drafts', collection => {
62-
return collection.getFilteredByGlob('./post/**/*.md').filter(_ => !livePosts(_)).reverse();
63-
})
64-
65-
config.addCollection('podcasts', collection => {
66-
return collection.getFilteredByGlob('./podcast/**/*.md').filter(_ => livePosts(_)).reverse()
61+
return collection.getFilteredByGlob('./post/**/*.md').filter(_ => !livePosts(_)).reverse()
6762
})
6863

6964
config.addCollection('books', (collection) => {
@@ -91,28 +86,31 @@ module.exports = (config) => {
9186

9287
for (const tag of tags)
9388
tag.startsWith('_') || uniqueTags.add(tag)
94-
});
89+
})
9590

96-
return [...uniqueTags];
91+
return [...uniqueTags]
9792
})
9893

94+
// The ever-popular markdown filter.
95+
9996
let md = markdownIt({
10097
html: true,
10198
breaks: true,
10299
linkify: true,
103100
typographer: true,
104101
})
105102

106-
// The ever-popular markdown filter.
107103
config.addFilter("markdown", (content) => md.render(content))
108104

109105
md.use(markdownItAnchor, {
110106
permalink: true,
111107
permalinkClass: 'direct-link',
112108
permalinkSymbol: '',
113109
})
114-
.use(markdownItFootnote)
115-
.use(markdownItContainer, 'image-hero', { marker: '!' })
110+
111+
md.use(markdownItFootnote)
112+
113+
md.use(markdownItContainer, 'image-hero', { marker: '!' })
116114
.use(markdownItContainer, 'signature', { marker: '!' })
117115
.use(markdownItContainer, 'image-sbs', { marker: '!' })
118116
.use(markdownItContainer, 'text-center', { marker: '!' })
@@ -126,7 +124,7 @@ module.exports = (config) => {
126124
return true
127125
},
128126
render: function (tokens, idx) {
129-
var m = tokens[idx].info.trim() // .match(/^well\s+(.*)$/);
127+
var m = tokens[idx].info.trim() // .match(/^well\s+(.*)$/)
130128
if (tokens[idx].nesting === 1) {
131129
// opening tag
132130
let summary = m === '' ? '' : '<summary>' + md.renderInline(m) + '</summary>\n'
@@ -140,81 +138,76 @@ module.exports = (config) => {
140138

141139
// Responsive Images inside Markdown
142140

143-
const imageResizer = (width, height, origin) => {
144-
baseUrl = !origin.startsWith('https://') && !origin.startsWith('http://') ? `https://chrisspiegl.com${origin}` : origin
145-
if (process.env.ELEVENTY_ENV == 'production') return `https://wrender.spiegl.co/resize/${width}/${height}/${baseUrl}`
146-
else return `${origin}`
147-
}
148-
md.use(markdownItResponsive, {
149-
responsive: {
150-
srcset: {
151-
"*.jpg": [
152-
{
153-
width: 320,
154-
rename: { suffix: "-320w" },
155-
},
156-
{
157-
width: 640,
158-
rename: { suffix: "-640w" },
159-
},
160-
{
161-
width: 1280,
162-
rename: { suffix: "-1280w" },
163-
},
164-
{
165-
width: 1920,
166-
rename: { suffix: "-1920w" },
167-
},
168-
// {
169-
// width: 3840,
170-
// rename: { suffix: "-3840w" },
171-
// },
172-
],
173-
"*.png": [
174-
{
175-
width: 320,
176-
rename: { suffix: "-320w" },
177-
},
178-
{
179-
width: 640,
180-
rename: { suffix: "-640w" },
181-
},
182-
{
183-
width: 1280,
184-
rename: { suffix: "-1280w" },
185-
},
186-
{
187-
width: 1920,
188-
rename: { suffix: "-1920w" },
189-
},
190-
// {
191-
// width: 3840,
192-
// rename: { suffix: "-3840w" },
193-
// },
194-
],
195-
},
196-
197-
sizes: {
198-
// "*": "(max-width: 320px), (max-width: 640px), (max-width: 1280px), 1920px",
199-
},
141+
md.use(markdownItResponsive, {
142+
responsive: {
143+
srcset: {
144+
"*.jpg": [
145+
{
146+
width: 320,
147+
rename: { suffix: "-320w" },
148+
},
149+
{
150+
width: 640,
151+
rename: { suffix: "-640w" },
152+
},
153+
{
154+
width: 1280,
155+
rename: { suffix: "-1280w" },
156+
},
157+
{
158+
width: 1920,
159+
rename: { suffix: "-1920w" },
160+
},
161+
// {
162+
// width: 3840,
163+
// rename: { suffix: "-3840w" },
164+
// },
165+
],
166+
"*.png": [
167+
{
168+
width: 320,
169+
rename: { suffix: "-320w" },
170+
},
171+
{
172+
width: 640,
173+
rename: { suffix: "-640w" },
174+
},
175+
{
176+
width: 1280,
177+
rename: { suffix: "-1280w" },
178+
},
179+
{
180+
width: 1920,
181+
rename: { suffix: "-1920w" },
182+
},
183+
// {
184+
// width: 3840,
185+
// rename: { suffix: "-3840w" },
186+
// },
187+
],
188+
},
189+
190+
sizes: {
191+
// "*": "(max-width: 320px), (max-width: 640px), (max-width: 1280px), 1920px",
200192
},
201-
});
193+
},
194+
})
202195

203196
md.renderer.rules.footnote_caption = (tokens, idx) => {
204-
let n = Number(tokens[idx].meta.id + 1).toString();
197+
let n = Number(tokens[idx].meta.id + 1).toString()
205198

206199
if (tokens[idx].meta.subId > 0) {
207-
n += ":" + tokens[idx].meta.subId;
200+
n += ":" + tokens[idx].meta.subId
208201
}
209202

210-
return n;
211-
};
203+
return n
204+
}
212205

213-
config.setLibrary("md", md);
206+
config.setLibrary("md", md)
214207

215208
return {
216209
dir: {
217-
output: `_site_${envLong}`,
210+
output: `_site`,
218211
},
219212
// dir: {
220213
// output: "dist",
@@ -230,6 +223,6 @@ module.exports = (config) => {
230223
// dataTemplateEngine: "njk",
231224
// htmlTemplateEngine: "njk",
232225
markdownTemplateEngine: "njk",
233-
passthroughFileCopy: true
226+
passthroughFileCopy: true,
234227
}
235228
}

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
_site_development
1+
_site
22
post/**/draft-*
33

44
### Node ###

0 commit comments

Comments
 (0)