the home site for me: also iteration 3 or 4 of my site
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: enhance title extraction for tag files in OG generation

+12 -4
+12 -4
tools/genOG.ts
··· 66 66 // for each file, get the title tag from the index.html 67 67 for (const file of files) { 68 68 const index = await Bun.file(`public/${file}`).text(); 69 - const title = index.match(/<title>(.*?)<\/title>/)![1]; 70 - if (!title) { 71 - console.error(`No title found for ${file}`); 72 - continue; 69 + let title: string; 70 + if (file.startsWith("tags/")) { 71 + const parts = file.split("/"); 72 + title = `Tag: ${parts[1]}`; // take the next directory as the title 73 + } else { 74 + const match = index.match(/<title>(.*?)<\/title>/); 75 + if (match) { 76 + title = match[1]; 77 + } else { 78 + console.error(`No title found for ${file}`); 79 + continue; 80 + } 73 81 } 74 82 75 83 console.log("Generating OG for", title);