···6666 // for each file, get the title tag from the index.html
6767 for (const file of files) {
6868 const index = await Bun.file(`public/${file}`).text();
6969- const title = index.match(/<title>(.*?)<\/title>/)![1];
7070- if (!title) {
7171- console.error(`No title found for ${file}`);
7272- continue;
6969+ let title: string;
7070+ if (file.startsWith("tags/")) {
7171+ const parts = file.split("/");
7272+ title = `Tag: ${parts[1]}`; // take the next directory as the title
7373+ } else {
7474+ const match = index.match(/<title>(.*?)<\/title>/);
7575+ if (match) {
7676+ title = match[1];
7777+ } else {
7878+ console.error(`No title found for ${file}`);
7979+ continue;
8080+ }
7381 }
74827583 console.log("Generating OG for", title);