{{ item.data.description }}
From 7cd73f703f6e04f307c698200a9d0b24d0c5c1dc Mon Sep 17 00:00:00 2001
From: Joshua Seigler <2583159+seigler@users.noreply.github.com>
Date: Fri, 7 Jun 2024 15:39:27 -0400
Subject: [PATCH] site data, twitter/opengraph headers
---
eleventy.config.js | 22 ++++++++++++++-----
package.json | 1 +
pnpm-lock.yaml | 8 +++++++
site/_data/site.js | 9 ++++++++
site/_includes/-header.njk | 6 ++---
site/_includes/base.njk | 12 ++++++++--
site/_includes/collection.njk | 2 +-
...20-07-02-authority-consents-blind-spot.md} | 0
...4-03--trivium.md => 2021-04-03-trivium.md} | 0
...> 2021-05-26-needs-based-communication.md} | 0
...m.md => 2021-10-16-embracing-mysticism.md} | 0
...023-07-14-finally-a-coherent-worldview.md} | 0
...05--redesign.md => 2024-06-05-redesign.md} | 0
site/posts/posts.11tydata.js | 8 +++----
14 files changed, 52 insertions(+), 16 deletions(-)
create mode 100644 site/_data/site.js
rename site/posts/{2020-07-02--authority-consents-blind-spot.md => 2020-07-02-authority-consents-blind-spot.md} (100%)
rename site/posts/{2021-04-03--trivium.md => 2021-04-03-trivium.md} (100%)
rename site/posts/{2021-05-26--needs-based-communication.md => 2021-05-26-needs-based-communication.md} (100%)
rename site/posts/{2021-10-16--embracing-mysticism.md => 2021-10-16-embracing-mysticism.md} (100%)
rename site/posts/{2023-07-14--finally-a-coherent-worldview.md => 2023-07-14-finally-a-coherent-worldview.md} (100%)
rename site/posts/{2024-06-05--redesign.md => 2024-06-05-redesign.md} (100%)
diff --git a/eleventy.config.js b/eleventy.config.js
index fad5513..45cad26 100644
--- a/eleventy.config.js
+++ b/eleventy.config.js
@@ -4,7 +4,9 @@ const md = require("markdown-it");
const mdAnchor = require("markdown-it-anchor");
const mdFootnote = require("markdown-it-footnote");
const prettier = require("prettier");
+const dayjs = require("dayjs")
const clean = require("eleventy-plugin-clean");
+const site = require("./site/_data/site");
module.exports = (config) => {
const slugify = config.getFilter("slugify");
@@ -21,10 +23,10 @@ module.exports = (config) => {
symbol: "",
}),
})
- .use(mdFootnote)
+ .use(mdFootnote);
config.setLibrary("md", mdLib);
config.addPassthroughCopy({
- "assets": "/"
+ assets: "/",
});
// collection from music folder
@@ -52,8 +54,8 @@ module.exports = (config) => {
});
config.addTransform("prettier", (content, outputPath) => {
- if (typeof outputPath !== 'string') {
- return content
+ if (typeof outputPath !== "string") {
+ return content;
}
const extname = path.extname(outputPath);
switch (extname) {
@@ -66,7 +68,17 @@ module.exports = (config) => {
default:
return content;
}
- })
+ });
+
+ config.addFilter("absoluteURL", (url) => {
+ return new URL(url, site.baseUrl).href;
+ });
+ config.addFilter("toISOString", (dateString) => {
+ return new Date(dateString).toISOString()
+ });
+ config.addFilter("formatDate", (date, format) => {
+ return dayjs(date).format(format);
+ });
clean.updateFileRecord("dist");
return {
diff --git a/package.json b/package.json
index 5ef82fe..e48c9a5 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,7 @@
"license": "ISC",
"dependencies": {
"@11ty/eleventy": "^2.0.1",
+ "dayjs": "^1.11.11",
"eleventy-plugin-clean": "^1.2.6",
"markdown-it-anchor": "^9.0.1",
"markdown-it-footnote": "^4.0.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index e968fb6..b237eae 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -11,6 +11,9 @@ importers:
'@11ty/eleventy':
specifier: ^2.0.1
version: 2.0.1
+ dayjs:
+ specifier: ^1.11.11
+ version: 1.11.11
eleventy-plugin-clean:
specifier: ^1.2.6
version: 1.2.6(@11ty/eleventy@2.0.1)
@@ -291,6 +294,9 @@ packages:
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
engines: {node: '>= 8'}
+ dayjs@1.11.11:
+ resolution: {integrity: sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==}
+
debug@2.6.9:
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
peerDependencies:
@@ -1244,6 +1250,8 @@ snapshots:
shebang-command: 2.0.0
which: 2.0.2
+ dayjs@1.11.11: {}
+
debug@2.6.9:
dependencies:
ms: 2.0.0
diff --git a/site/_data/site.js b/site/_data/site.js
new file mode 100644
index 0000000..9dff1bf
--- /dev/null
+++ b/site/_data/site.js
@@ -0,0 +1,9 @@
+const isDev = process.env.ELEVENTY_ENV === "development";
+
+const baseUrl = isDev ? "localhost:8080" : "https://joshua.seigler.net/";
+
+module.exports = {
+ title: "joshua.seigler.net",
+ description: "Personal homepage of Joshua Seigler",
+ baseUrl,
+};
diff --git a/site/_includes/-header.njk b/site/_includes/-header.njk
index cd32e62..627e55b 100644
--- a/site/_includes/-header.njk
+++ b/site/_includes/-header.njk
@@ -1,7 +1,7 @@
{{ item.data.description }}