Skip to content

Commit c17107f

Browse files
authored
Merge branch 'master' into prepare-for-main-rename
2 parents fdb5372 + da43058 commit c17107f

File tree

145 files changed

+2865
-2046
lines changed

Some content is hidden

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

145 files changed

+2865
-2046
lines changed

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 2
7+
tab_width = 2
8+
indent_style = space
9+
insert_final_newline = true
10+
trim_trailing_whitespace = true
11+
12+
[*{sh,py}]
13+
indent_size = 4

.eleventy.js

Lines changed: 37 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,27 @@ const {
1717
} = require('@vidhill/fortawesome-brands-11ty-shortcode');
1818

1919

20-
module.exports = function(eleventyConfig) {
20+
const media_filetypes = "jpg,jpeg,JPG,png,gif,svg,avif";
21+
22+
async function img_responsive(src, alt, sizes = "100vw, 720, 820, 940, 1140, 1280", class_names = "img-responsive") {
23+
let metadata = await fetch_image(src);
24+
let imageAttributes = {
25+
alt,
26+
sizes,
27+
class: class_names,
28+
loading: "lazy",
29+
decoding: "async",
30+
};
31+
32+
return Image.generateHTML(metadata, imageAttributes);
33+
}
34+
35+
module.exports = function (eleventyConfig) {
2136
// Configure markdown parser
22-
const markdownLib = markdownIt({html: true, typographer: true});
37+
const markdownLib = markdownIt({ html: true, typographer: true });
2338
markdownLib.use(markdownItAnchor);
2439
markdownLib.use(markdownItAttrs);
25-
40+
2641
eleventyConfig.setLibrary("md", markdownLib);
2742
eleventyConfig.addPlugin(fortawesomeBrandsPlugin);
2843
eleventyConfig.addPlugin(syntaxHighlight);
@@ -34,11 +49,11 @@ module.exports = function(eleventyConfig) {
3449
eleventyConfig.addPassthroughCopy("assets");
3550
eleventyConfig.addPassthroughCopy("dist");
3651
eleventyConfig.addPassthroughCopy("favicon.png");
37-
eleventyConfig.addPassthroughCopy("galleries/**/*.{jpg,jpeg,JPG,png,gif,svg}");
52+
eleventyConfig.addPassthroughCopy("galleries/**/*." + media_filetypes);
3853
eleventyConfig.addPassthroughCopy("google5458abc1104b04dd.html");
39-
eleventyConfig.addPassthroughCopy({"htaccess": ".htaccess"});
40-
eleventyConfig.addPassthroughCopy({"content": "."}, {
41-
filter: ["**/*.{jpg,jpeg,JPG,png,gif,svg}"],
54+
eleventyConfig.addPassthroughCopy({ "htaccess": ".htaccess" });
55+
eleventyConfig.addPassthroughCopy({ "content": "." }, {
56+
filter: ["**/*." + + media_filetypes],
4257
rename: function (path) {
4358
return path.replace("content/", "");
4459
}
@@ -47,7 +62,7 @@ module.exports = function(eleventyConfig) {
4762
eleventyConfig.addWatchTarget("src/**/*");
4863
let $collectionApi = null;
4964

50-
eleventyConfig.addCollection("posts", function(collectionApi) {
65+
eleventyConfig.addCollection("posts", function (collectionApi) {
5166
$collectionApi = collectionApi;
5267
return collectionApi.getFilteredByGlob("_posts/*.md");
5368
});
@@ -56,55 +71,12 @@ module.exports = function(eleventyConfig) {
5671
dynamicPartials: false,
5772
});
5873

59-
eleventyConfig.addFilter("cssmin", function(code) {
74+
eleventyConfig.addFilter("cssmin", function (code) {
6075
return new CleanCSS({}).minify(code).styles;
6176
});
6277

63-
eleventyConfig.addShortcode("image", async function(src, alt, sizes) {
64-
let metadata = await fetch_image(src);
65-
66-
let imageAttributes = {
67-
alt,
68-
sizes,
69-
loading: "lazy",
70-
decoding: "async",
71-
};
72-
73-
// You bet we throw an error on a missing alt (alt="" works okay)
74-
return Image.generateHTML(metadata, imageAttributes);
75-
});
76-
77-
eleventyConfig.addShortcode("img_responsive", async function(src, alt, sizes="100vw, 720, 820, 940, 1140, 1280") {
78-
let metadata = await fetch_image(src);
79-
let imageAttributes = {
80-
alt,
81-
sizes,
82-
class: "img-responsive",
83-
loading: "lazy",
84-
decoding: "async",
85-
};
86-
87-
return Image.generateHTML(metadata, imageAttributes);
88-
});
89-
90-
eleventyConfig.addShortcode("image_with_class", async function(src, alt, sizes, class_names) {
91-
let metadata = await fetch_image(src);
92-
93-
if (sizes==undefined || sizes=="_") {
94-
sizes="720, 940, 1140, 1280, 2048";
95-
}
96-
97-
let imageAttributes = {
98-
alt,
99-
sizes,
100-
class: class_names,
101-
loading: "lazy",
102-
decoding: "async",
103-
};
104-
105-
// You bet we throw an error on a missing alt (alt="" works okay)
106-
return Image.generateHTML(metadata, imageAttributes);
107-
});
78+
eleventyConfig.addShortcode("image", img_responsive);
79+
eleventyConfig.addShortcode("img_responsive", img_responsive);
10880

10981
// Thumbnails
11082
eleventyConfig.addShortcode("thumbnail_for_post", thumbnails.thumbnail_for_post);
@@ -122,15 +94,15 @@ module.exports = function(eleventyConfig) {
12294
});
12395

12496
// Liquid filter to convert a date to a string
125-
eleventyConfig.addLiquidFilter("to_utc_string", date => date.toUTCString() );
97+
eleventyConfig.addLiquidFilter("to_utc_string", date => date.toUTCString());
12698

12799
// Liquid filter for long date string
128-
eleventyConfig.addLiquidFilter("date_to_long_string", function(date) {
100+
eleventyConfig.addLiquidFilter("date_to_long_string", function (date) {
129101
return date.toLocaleDateString("en-GB", { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
130102
});
131103

132104
// Universal filter for jsonify
133-
eleventyConfig.addFilter("jsonify", JSON.stringify );
105+
eleventyConfig.addFilter("jsonify", JSON.stringify);
134106

135107
eleventyConfig.addFilter("with_explicit_date", items => items.filter(item => "date" in item.data));
136108

@@ -140,14 +112,14 @@ module.exports = function(eleventyConfig) {
140112

141113
// Read the menu data from _config.yml and add it to the global data
142114
eleventyConfig.addGlobalData("menu", () => getDataFromConfigYaml("menu"));
143-
eleventyConfig.addGlobalData("site_title", () => getDataFromConfigYaml("title"));
144-
eleventyConfig.addGlobalData("site_tagline", () => getDataFromConfigYaml("tagline"));
145-
eleventyConfig.addGlobalData("production_url", () => getDataFromConfigYaml("production_url"));
146-
eleventyConfig.addGlobalData("JB", () => getDataFromConfigYaml("JB"));
147-
eleventyConfig.addGlobalData("author", () => getDataFromConfigYaml("author"));
148-
eleventyConfig.addGlobalData("now" , () => new Date());
149-
150-
eleventyConfig.addNunjucksFilter("date", function(date, format) {
115+
eleventyConfig.addGlobalData("site_title", () => getDataFromConfigYaml("title"));
116+
eleventyConfig.addGlobalData("site_tagline", () => getDataFromConfigYaml("tagline"));
117+
eleventyConfig.addGlobalData("production_url", () => getDataFromConfigYaml("production_url"));
118+
eleventyConfig.addGlobalData("JB", () => getDataFromConfigYaml("JB"));
119+
eleventyConfig.addGlobalData("author", () => getDataFromConfigYaml("author"));
120+
eleventyConfig.addGlobalData("now", () => new Date());
121+
122+
eleventyConfig.addNunjucksFilter("date", function (date, format) {
151123
return moment(date).format(format);
152124
});
153125

.gitattributes

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
# Auto detect text files and perform LF normalization
2-
* text=lf
3-
4-
# Custom for Visual Studio
5-
*.cs diff=csharp
6-
*.sln merge=union
7-
*.csproj merge=union
8-
*.vbproj merge=union
9-
*.fsproj merge=union
10-
*.dbproj merge=union
11-
12-
# Standard to msysgit
13-
*.doc diff=astextplain
14-
*.DOC diff=astextplain
15-
*.docx diff=astextplain
16-
*.DOCX diff=astextplain
17-
*.dot diff=astextplain
18-
*.DOT diff=astextplain
19-
*.pdf diff=astextplain
20-
*.PDF diff=astextplain
21-
*.rtf diff=astextplain
22-
*.RTF diff=astextplain
1+
# Auto detect text files and perform LF normalization
2+
* text=lf
3+
4+
# Standard to msysgit
5+
*.doc diff=astextplain
6+
*.DOC diff=astextplain
7+
*.docx diff=astextplain
8+
*.DOCX diff=astextplain
9+
*.dot diff=astextplain
10+
*.DOT diff=astextplain
11+
*.pdf diff=astextplain
12+
*.PDF diff=astextplain
13+
*.rtf diff=astextplain
14+
*.RTF diff=astextplain

.github/dependabot.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@ updates:
99
schedule:
1010
# Check for updates to GitHub Actions every week
1111
interval: "weekly"
12+
1213
- package-ecosystem: "npm"
1314
directory: "/"
14-
versioning-strategy: auto
1515
schedule:
1616
# Check for updates to npm dependencies every week
1717
interval: "weekly"
1818
ignore:
1919
- dependency-name: "*"
2020
update-types: ["version-update:semver-patch"]
21+
22+
23+
- package-ecosystem: "docker"
24+
directories:
25+
- "**/*"
26+
schedule:
27+
# Check for updates to Docker images every week
28+
interval: "weekly"

.github/scripts/new_post.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/bin/bash
2+
# Helper to create a new blog post, and folder structure, open it in vs code.
3+
# Usage:
4+
# ./.github/scripts/new_post.sh "Post title not slugged but in quotes"
5+
6+
set -eu -o pipefail
7+
8+
9+
function slug_from_title_and_date {
10+
echo "$POST_DAY-$1" | tr '[:upper:]' '[:lower:]' | tr -s ' ' '-' | tr -s '[:punct:]' '-'
11+
}
12+
13+
function make_folder_path {
14+
local slug="$1"
15+
echo "content/$POST_YEAR/$POST_MONTH/$slug"
16+
}
17+
18+
function file_path {
19+
local slug="$1"
20+
local folder_path="$2"
21+
echo "$folder_path/${slug}.md"
22+
}
23+
24+
function create_post {
25+
local file_path="$1"
26+
echo "Creating post at $file_path"
27+
touch "$file_path"
28+
(
29+
echo "---"
30+
echo "title: $POST_TITLE"
31+
echo "date: $POST_DATE"
32+
echo "thumbnail: /content/${POST_YEAR}/${POST_MONTH}/${slug}.jpg"
33+
echo "---"
34+
) >"$file_path"
35+
}
36+
37+
# Bash argument handler
38+
function usage {
39+
echo "Usage: $0 [--date <date>|defaults to today] <\"Post title not slugged but in quotes\">"
40+
echo "Example: $0 \"My New Blog Post\""
41+
echo "This script creates a new blog post with the given title, slugifies it, and opens it in VS Code."
42+
echo "Example with date: $0 --date 2023-10-01 \"My New Blog Post\""
43+
exit 1
44+
}
45+
46+
function extract_date_elements {
47+
# Extract the year, month, and day from the post date
48+
POST_YEAR=$(date -d "$POST_DATE" +"%Y")
49+
POST_MONTH=$(date -d "$POST_DATE" +"%m")
50+
POST_DAY=$(date -d "$POST_DATE" +"%d")
51+
}
52+
53+
function handle_arguments {
54+
# Handle an optional argument for the post date (defaults to today)
55+
if [ "$#" -eq 3 ] && [ "$1" == "--date" ]; then
56+
POST_DATE="$2"
57+
shift 2
58+
else
59+
POST_DATE=$(date +"%Y-%m-%d")
60+
fi
61+
62+
# Handle no arguments, -h or --help
63+
if [ "$#" -eq 0 ] || [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
64+
usage
65+
fi
66+
67+
extract_date_elements
68+
POST_TITLE=$1
69+
}
70+
71+
function main {
72+
local slug="$(slug_from_title_and_date "$POST_TITLE")"
73+
local folder_path="$(make_folder_path "$slug")"
74+
local file_path="$(file_path "$slug" "$folder_path")"
75+
mkdir -p "$folder_path"
76+
create_post "$file_path"
77+
code "$file_path"
78+
}
79+
80+
handle_arguments "$@"
81+
main

.github/workflows/on_call_build_site.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ jobs:
3131
tar -czf _site.tar.gz _site
3232
3333
- name: upload site artifact
34-
uses: actions/upload-artifact@v4
34+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3535
with:
3636
name: _site
3737
path: _site.tar.gz
3838
if-no-files-found: error
3939

4040
- name: upload httpd.conf artifact
41-
uses: actions/upload-artifact@v4
41+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
4242
with:
4343
name: httpd.conf
4444
path: _drafts/staging/httpd.conf

.github/workflows/on_call_staging_test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
steps:
99
- uses: actions/checkout@v4
1010
- name: Fetch site artifact
11-
uses: actions/download-artifact@v4.1.8
11+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
1212
with:
1313
name: _site
1414
- name: extract site artifact

.github/workflows/on_pr_lint.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: "On PR Lint"
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
check_dependabot:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout source code
13+
uses: actions/checkout@v4
14+
15+
- name: Check Changes
16+
id: changed-env
17+
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
18+
with:
19+
files: |
20+
.github/dependabot.yml
21+
22+
- if: |
23+
steps.changed-env.outputs.any_modified == 'true'
24+
run: |
25+
npx -y @bugron/validate-dependabot-yaml@latest
26+
27+
lint_cupcake:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout source code
31+
uses: actions/checkout@v4
32+
33+
- name: Lint Code Base
34+
continue-on-error: true
35+
uses: oxsecurity/megalinter/flavors/cupcake@v8.7.0
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/on_pr_test.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
branches:
55
- master
66
- main
7+
paths-ignore:
8+
- README.md
9+
- .github/on_pr_lint.yaml
10+
- _drafts/**
11+
- .vscode/**
712

813
jobs:
914
build_site:
@@ -12,4 +17,3 @@ jobs:
1217
staging_test:
1318
uses: ./.github/workflows/on_call_staging_test.yaml
1419
needs: build_site
15-

0 commit comments

Comments
 (0)