Skip to content

fix: redirect outdated post slugs to the current one - #7002

Merged
idoshamun merged 1 commit into
mainfrom
fix/post-outdated-slug-redirect
Oct 22, 2026
Merged

idoshamun merged 1 commit into
mainfrom
fix/post-outdated-slug-redirect

Conversation

@idoshamun

@idoshamun idoshamun commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Problem

A post slug follows its title (<title>-<id>), so editing a title breaks every shared link and indexed URL that used the old slug.

Fix

/posts/[id] getStaticProps: if the post comes back with a slug and the requested param is neither its id nor its current slug, we return a permanent redirect to /posts/<current slug> (revalidate: 60). Search engines then move the old URL over to the new one. Requests by id or by the current slug render as before, so the id URLs used by the post modal don't change.

Depends on dailydotdev/daily-api#4468. Until that's deployed, the API returns NOT_FOUND for old slugs and the page still 404s. Merging this first is harmless.

Notes

  • Next serves permanent: true as a 308. Google treats it the same as a 301.
  • A redirect from getStaticProps drops query params (for example UTM tags) on old-slug links. Old links resolve again, but those params are lost on the hop.

Tests

  • PostStaticProps.spec.ts: an old slug redirects without fetching comments; the id and the current slug still render. The fixture id is now post-id so the existing tests keep requesting the post by its id.
  • eslint and typecheck-strict-changed pass.

🤖 Written by Smith (AI) on behalf of @idoshamun

Preview domain

https://fix-post-outdated-slug-redirect.preview.app.daily.dev

The slug follows the post title, so editing a title left every shared
and indexed link on a slug that no longer exists. The API now resolves
outdated slugs by their trailing id (dailydotdev/daily-api#4468); the
page answers them with a permanent redirect to the current slug so
search engines move the URL over. Requests by id or by the current
slug render as before.
@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
daily-webapp Ready Ready Preview Oct 22, 2026 7:23am UTC
1 Skipped Deployment
Project Deployment Actions Updated
storybook Ignored Ignored Oct 22, 2026 7:23am UTC

Request Review

@idoshamun
idoshamun merged commit 0ec6039 into main Oct 22, 2026
12 checks passed
@idoshamun
idoshamun deleted the fix/post-outdated-slug-redirect branch October 22, 2026 10:16

This branch was successfully deployed

1 active deployment
Preview – daily-webapp — f66f4158 Deployed Oct 22, 2026 by vercel[bot]
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.

1 participant