diff --git a/src/images/me.jpg b/src/images/me.jpg index 7f70c19..81fd7b0 100644 Binary files a/src/images/me.jpg and b/src/images/me.jpg differ diff --git a/src/now.11tydata.js b/src/now.11tydata.js new file mode 100644 index 0000000..700fbb8 --- /dev/null +++ b/src/now.11tydata.js @@ -0,0 +1,28 @@ +module.exports = { + eleventyComputed: { + content: async () => { + // Retrieve the /now page from the server + const response = await fetch("https://api.omg.lol/address/lewis/now"); + const body = await response.json(); + + // Convert the unix timestamp to a JS datetime timestamp + const updated = new Date(body.response.now.updated * 1000); + let content = body.response.now.content; + + // Replace the last-updated tag + content = content.replace("{last-updated}", `Updated ${updated.toLocaleDateString('en-GB', { dateStyle: "medium" })}`); + // Strip out omg.lol-specific tags + content = content.replaceAll(/{[^}]*}/g, ""); + // remove comments + content = content.replaceAll(/\/\*.*?\*\//g, ""); + + // Remove everything before the --- Now --- marker, because I handle page titles and headings in 11ty + if (content.includes("--- Now ---")) { + const [before, after] = content.split("--- Now ---"); + content = after; + } + + return content; + } + } +} \ No newline at end of file diff --git a/src/now.md b/src/now.md index 14154c1..d1fa3f9 100644 --- a/src/now.md +++ b/src/now.md @@ -3,17 +3,4 @@ title: My /now page layout: page.njk --- -## What I'm reading - -* :book: The Player of Games by Iain M. Banks - -## What I'm watching - -* :tv: For All Mankind - -## What I'm enjoying - -* :bicycle: Preparing for a 100km charity cycle -* :people-roof: Spending time with my family -* :computer: Working on my ZX Basic interpreter -* :gamepad: Playing The Outer Worlds on Nintendo Switch +{{ content | safe }}