Skip to content

Commit bee3325

Browse files
stasadevclaude
andauthored
fix(blog): use original filename for GitHub edit URL (#528)
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 373202d commit bee3325

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pages/blog/[id].astro

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ export async function getStaticPaths() {
2020
const { entry } = Astro.props
2121
const { Content, remarkPluginFrontmatter } = await render(entry)
2222
23+
// Extract original filename from file path for GitHub edit URL
24+
// entry.id is URL-safe (dots removed), but we need the actual filename
25+
const originalFilename = entry.filePath
26+
? entry.filePath.split('/').pop().replace(/\.mdx?$/, '')
27+
: entry.id
28+
2329
const author = await getEntry("authors", getSlug(entry.data.author))
2430
2531
const hasFeatureImage =
@@ -86,7 +92,7 @@ const blogPostSchema = [
8692
authorUrl={`/blog/author/${author.id}`}
8793
authorAvatar={authorImage}
8894
readTime={remarkPluginFrontmatter.minutesRead}
89-
editUrl={GITHUB_URL_WEBSITE+`/`+entry.id+`.md`}
95+
editUrl={GITHUB_URL_WEBSITE+`/`+originalFilename+`.md`}
9096
/>
9197
{
9298
hasFeatureImage && shouldDisplayFeatureImage && (

0 commit comments

Comments
 (0)