fix(og): match plain URL slugs; fix Funkwhale GC wipe
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m19s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 1m19s
og-fix transform was matching date-based URL segments (/type/yyyy/MM/dd/slug/) that this site never uses — posts live at /type/slug/. Every post therefore fell through to the default OG image. Fixed by updating the regex to /type/slug/index.html and deriving the OG slug as the bare last URL segment, which matches the filename og.js already generates. The ogSlug filter is simplified accordingly. Funkwhale GC bug: gcFunkwhaleImages() deleted the entire image cache whenever _activeFilenames was empty — which happens if the API returns valid stats but no listenings with cover URLs. Guard added: GC is skipped when no images were referenced this build. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,10 @@ export async function cacheFunkwhaleImage(url) {
|
||||
*/
|
||||
export function gcFunkwhaleImages() {
|
||||
if (!existsSync(CACHE_DIR)) return;
|
||||
// If no images were referenced this build, skip GC — likely the API returned no
|
||||
// cover URLs (empty listenings, null covers, or stats-only response). Deleting
|
||||
// everything from an empty _activeFilenames set would wipe a valid cache.
|
||||
if (_activeFilenames.size === 0) return;
|
||||
let deleted = 0;
|
||||
for (const file of readdirSync(CACHE_DIR)) {
|
||||
if (!_activeFilenames.has(file)) {
|
||||
|
||||
@@ -126,7 +126,8 @@ function formatDate(dateStr) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the full filename (with date prefix) as the OG image slug.
|
||||
* Use the filename (without extension) as the OG image slug.
|
||||
* Matches the last URL path segment, which Eleventy derives from the filename.
|
||||
*/
|
||||
function toOgSlug(filename) {
|
||||
return filename;
|
||||
|
||||
Reference in New Issue
Block a user