From 31053d715055c46e3c8865fe96ca216e3b234d58 Mon Sep 17 00:00:00 2001 From: Doug Hatcher Date: Mon, 18 May 2026 21:54:33 -0400 Subject: [PATCH] fix(publish): keep date prefix in derived blog URL Hugo permalink for blog posts is /blog/YYYY-MM-DD-slug/, not /blog/slug/. publish.js was stripping the leading date, generating URLs that 404. The LinkedIn cross-post body has been carrying a broken "Full post:" link since the rewrite. Pre-generated linkedin_copy uses {{url}} substitution, so this single-line change fixes every existing and future post. --- apps/editorial-loop/publish.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/editorial-loop/publish.js b/apps/editorial-loop/publish.js index 2112bda..3f73160 100644 --- a/apps/editorial-loop/publish.js +++ b/apps/editorial-loop/publish.js @@ -20,9 +20,9 @@ async function main() { const content = fs.readFileSync(POST_PATH, 'utf8'); - // Derive public URL from file path: content/blog/2026-04-18-my-slug.md → /blog/my-slug/ - const filename = POST_PATH.split('/').pop().replace('.md', ''); - const slug = filename.replace(/^\d{4}-\d{2}-\d{2}-/, ''); + // Derive public URL from file path: content/blog/2026-04-18-my-slug.md → /blog/2026-04-18-my-slug/ + // Hugo permalink includes the date prefix; the full basename (sans .md) is the slug. + const slug = POST_PATH.split('/').pop().replace('.md', ''); const postUrl = `${BASE_URL}/blog/${slug}/`; console.log(`📖 Post: ${POST_PATH}`);