Repository navigation
fix: add per-page metadata and 404 for unknown slugs - #89
Merged
Merged
Conversation
Blog posts and pages now get their own title, description and Open Graph tags. Unknown slugs return a 404 instead of a 200.
Member
|
thx for contributing! |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Blog posts and pages didn't set their own metadata, so all of them used the root title ("DevHub | Code. Create. Collaborate.") and the same link preview. They now set title, description, canonical URL and Open Graph / Twitter tags from their front matter. Blog posts also get date, authors and tags. The site banner is kept, since
openGraphandtwitterreplace the root values instead of merging.Unknown slugs like
/blog/does-not-existshowed the 404 page but with a 200 status, becausenotFound()ran inside the Suspense boundary after the response had already started. The slug is now checked before the Suspense boundary. Both routes also gotgenerateStaticParams, so posts and pages are prerendered at build time.Closes
No related issue.
Type of change(s)
Checklist
bun run lintornpm run lintcompletes without warnings or errorsbun run buildornpm run buildcompletes successfullyfeat: ...,fix: ...,chore: ...)console.log)Anything else the reviewer should know?
/blog,/partnersand/rulesstill use the default title. I left them out to keep this PR small and can add them in a follow-up if you want.