--- import PageLayout from "../layouts/PageLayout.astro"; import { Image } from "astro:assets"; import { parse } from "node:path"; const albumCovers = await Astro.glob("../content/album-covers/*"); const processedAlbumCovers = albumCovers.map((cover) => { const filePathWithoutParams = cover.default.src.split("?")[0]; const filename = parse(filePathWithoutParams).name; const lastDashIndex = filename.lastIndexOf(" - "); const artists = lastDashIndex !== -1 ? filename.substring(0, lastDashIndex) : filename; const title = lastDashIndex !== -1 ? filename.substring(lastDashIndex + 3) : ""; return { cover, filename, artists, title }; }); const sortedAlbumCovers = processedAlbumCovers.sort((a, b) => a.title.localeCompare(b.title), ); ---

This is a collection of some of my favourite music tracks, each listed by artist and song title. Click on an album cover to go straight to the song on YouTube Music!

{ sortedAlbumCovers.map(({ cover, filename, artists, title }) => (
{`Cover

{title}

{artists}

)) }