Skip to content

fix: point blog "Edit on GitHub" link at the source file - #2567

Open
NopeCharon wants to merge 1 commit into
expressjs:mainfrom
NopeCharon:fix/blog-edit-link
Open

NopeCharon wants to merge 1 commit into
expressjs:mainfrom
NopeCharon:fix/blog-edit-link

Conversation

@NopeCharon

Copy link
Copy Markdown

Fixes #2565

Edit on GitHub is broken on every blog post because the URL is built from the route's slug, which has no extension and is lowercased. It now uses post.filePath, the same way the docs route uses page.filePath.

Link target
Before src/content/blog/2026-10-28-cve-2026-111181
After src/content/blog/2026-10-28-CVE-2026-111181.mdx

Validation

  • New tests/e2e/blog.spec.ts covers a mixed-case .md post and a mixed-case .mdx post.
  • Against astro dev in Chromium, both tests pass with the fix and fail without it. I didn't run Firefox or WebKit locally.
  • Prettier and ESLint pass on the changed files.

The link was built from the route's slug param, which has no file
extension and is lowercased, so it pointed at a path that does not exist
on GitHub for every blog post.

Use post.filePath, as the docs route already does with page.filePath, so
the link keeps the real filename and extension.

Add an e2e test covering a mixed-case .md post and a mixed-case .mdx post.

Fixes expressjs#2565

Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
@NopeCharon
NopeCharon requested a review from a team as a code owner November 6, 2026 14:08
@netlify

netlify Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for expressjscom-preview ready!

Name Link
🔨 Latest commit 422bcbe
🔍 Latest deploy log https://app.netlify.com/projects/expressjscom-preview/deploys/6aeddf4fd3a0bcdc662024ad
😎 Deploy Preview https://deploy-preview-2567--expressjscom-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 98 (🟢 up 1 from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: 80 (no change from production)
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Edit on GitHub" link is broken on every blog post

1 participant