Update to Eleventy v3 (#11)

* feat: upgrade to v3; install eleventy-upgrade-help

* feat: convert all files to esm

* feat: remove decapcms

* fix: remove unused filter

* feat: remove netlify packages

* feat: update image handling

- removes old image shortcode
- update to latest 11ty image transform plugin

* feat: update colophon

* fix: pill style; global style

Fixes an issue with <img> inside <figure> not being centered

* feat: remove linting packages

* feat: update package.json scripts

* feat: remove upgrade helper plugin

* feat: add new button style, update nav

* feat: simplify `pill` class usage

* feat: fix tag list in catalogue-item.html

* feat: move games into their own section

* feat: update node version to latest LTS

* feat: move books to their own section

* feat: move fun pages into pages dir

* feat: update index and book/game templates

* feat: add watching section

* fix: update scaling values for buttons

* feat: various css updates

* feat: update now page style

* feat: cleaning up newer posts using old shortcode

also adding markdown-it-attrs to add attrs to various markdown elements!

* fix: movie data structure

* feat: update colophon

* fix: remove text-skew from post excerpt text

* feat: add support for shows in /watching

* fix: update book tags

* feat: add complete implementation of books pages

other stuff happened too

* fix: image border-radius

* feat: update game layout and content

* feat: reorganize watching section

* feat: add contact page

* feat: small page changes

* feat: add podroll page

* feat: reorganize content directories

* feat: exclude podcasts from page output

* chore: delete guestbook page

* chore: remove bracket syntax for css classes in html

* feat: create macro for tag list

* fix: colophon update

* chore: remove last.fm data

* chore: clean up 11ty config

* fix: misc permalink fixes

* feat: add update post

* fix: media meta grid on mobile

* fix: tables on mobile

* fix: add titles to icon button links

* fix: add missing divider for movies/shows

* feat: add alternate feeds

* fix: tag cleanup

* feat: homepage content update

* fix: game meta data

* fix: update post dates

* feat: add missing link to changelog
This commit is contained in:
Devin Haska 2025-01-27 18:23:38 -08:00 committed by GitHub
parent e28e804e12
commit 5f8227a46b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
282 changed files with 4577 additions and 5016 deletions

View file

@ -87,4 +87,4 @@ const blogroll = [
const sortedBlogroll = blogroll.sort((a, b) => a.title.localeCompare(b.title));
module.exports = sortedBlogroll;
export default sortedBlogroll;

View file

@ -1,98 +0,0 @@
require("dotenv").config();
const EleventyFetch = require("@11ty/eleventy-fetch");
const dayjs = require("dayjs");
const utc = require("dayjs/plugin/utc");
const relativeTime = require("dayjs/plugin/relativeTime");
dayjs.extend(utc);
dayjs.extend(relativeTime);
const lastFmApiKey = process.env.LAST_FM_API_KEY;
const baseUrl = "http://ws.audioscrobbler.com";
const username = "wonderfulfrog";
const fetchLastFm = async (method, duration, extraArgs) => {
try {
const path = `/2.0/?method=${method}&user=${username}&api_key=${lastFmApiKey}&format=json`;
let url = `${baseUrl}${path}`;
if (extraArgs) {
url = `${url}&${extraArgs}`;
}
const response = await EleventyFetch(url, { duration, type: "json" });
return response;
} catch (e) {
console.error(`Error fetching last.fm data for method=${method}`, e);
return undefined;
}
};
const fetchRecentAlbums = async (period = "7day") => {
const response = await fetchLastFm(
"user.gettopalbums",
"7d",
`period=${period}`,
);
if (!response) {
return [];
}
const albums = response.topalbums.album.slice(0, 8);
const recentAlbums = albums.map((album) => {
const extraLargeImage = album.image.find(
(img) => img.size === "extralarge",
);
const imageUrl = extraLargeImage ? extraLargeImage["#text"] : "";
return {
artist: album.artist.name,
artistMbid: album.artist.mbid,
album: album.name,
albumMbid: album.mbid,
playcount: album.playcount,
url: album.url,
imageUrl,
};
});
return recentAlbums;
};
const fetchRecentTracks = async () => {
const response = await fetchLastFm("user.getrecenttracks", "5m");
if (!response) {
return [];
}
const tracks = response.recenttracks.track.slice(0, 5);
const recentTracks = tracks.map((track) => {
const timestamp = track.date
? dayjs(track.date["#text"]).utc(true).fromNow()
: dayjs().fromNow();
return {
artist: track.artist["#text"],
track: track.name,
url: track.url,
timestamp,
};
});
return recentTracks;
};
module.exports = async function () {
const recentTracks = await fetchRecentTracks();
const recentAlbums = await fetchRecentAlbums();
return {
recentTracks,
recentAlbums,
};
};

View file

@ -1,10 +1,10 @@
require("dotenv").config();
import "dotenv/config";
const EleventyFetch = require("@11ty/eleventy-fetch");
const cheerio = require("cheerio");
const dayjs = require("dayjs");
const utc = require("dayjs/plugin/utc");
const relativeTime = require("dayjs/plugin/relativeTime");
import EleventyFetch from "@11ty/eleventy-fetch";
import cheerio from "cheerio";
import dayjs from "dayjs";
import utc from "dayjs/plugin/utc.js";
import relativeTime from "dayjs/plugin/relativeTime.js";
dayjs.extend(utc);
dayjs.extend(relativeTime);
@ -33,7 +33,7 @@ const fetchRecentMovies = async () => {
$("channel")
.children("item")
.slice(0, 6)
.slice(0, 5)
.each((_, element) => {
const title = $(element).children("letterboxd\\:filmTitle").text();
@ -65,4 +65,4 @@ const fetchRecentMovies = async () => {
return recentMovies;
};
module.exports = fetchRecentMovies;
export default fetchRecentMovies;

View file

@ -1,4 +1,4 @@
module.exports = {
export default {
url: process.env.URL || "http://localhost:8080",
siteName: "wonderfulfrog",
siteDescription:
@ -7,9 +7,4 @@ module.exports = {
lang: "en",
author: "Devin Haska",
repoUrl: "https://github.com/wonderfulfrog/wonderfulfrog.com",
social: {
github: "https://github.com/wonderfulfrog",
mastodon: "https://mastodon.social/@wonderfulfrog",
lastfm: "https://www.last.fm/user/wonderfulfrog",
},
};

View file

@ -1,24 +1,41 @@
module.exports = {
export default {
top: [
{
text: "About",
url: "/about",
icon: "circle-info",
},
{
text: "Posts",
url: "/posts",
icon: "list",
},
{
text: "Catalogue",
url: "/catalogue",
text: "Games",
url: "/games",
icon: "game-controller",
},
{
text: "Watching",
url: "/watching",
icon: "tv-retro",
},
{
text: "Books",
url: "/books",
icon: "book",
},
],
bottom: [
{ text: "Blogroll", url: "/blogroll" },
{
text: "Colophon",
url: "/colophon",
},
{ text: "Blogroll", url: "/blogroll" },
{
text: "Contact",
url: "/contact",
},
{
text: "/uses",
url: "/uses",

View file

@ -1,5 +1,5 @@
const { getFontUrl } = require("../utils/fonts");
const fonts = require("../../config/design-tokens/fonts.json");
import { getFontUrl } from "../utils/fonts.js";
import fonts from "../../config/design-tokens/fonts.js";
const preloads = [
{
@ -19,4 +19,4 @@ const preloads = [
},
];
module.exports = preloads;
export default preloads;

View file

@ -1,6 +1,6 @@
require("dotenv").config();
import "dotenv/config";
const EleventyFetch = require("@11ty/eleventy-fetch");
import EleventyFetch from "@11ty/eleventy-fetch";
const accessToken = process.env.DARK_VISITORS_ACCESS_TOKEN;
@ -101,7 +101,7 @@ const fetchRobotsTxt = async () => {
}
};
module.exports = async function () {
export default async function () {
const robotsTxt = await fetchRobotsTxt();
if (!robotsTxt) {
@ -109,4 +109,4 @@ module.exports = async function () {
}
return robotsTxt;
};
}