Skip to content

Add a 404 page#32

Merged
michaelmwu merged 2 commits intomainfrom
add-404
Feb 16, 2026
Merged

Add a 404 page#32
michaelmwu merged 2 commits intomainfrom
add-404

Conversation

@br4e
Copy link
Collaborator

@br4e br4e commented Feb 14, 2026

Before:

Screenshot 2026-02-14 at 10 24 36 AM

After:

Screenshot 2026-02-14 at 10 24 34 AM

Summary by CodeRabbit

  • New Features
    • Added a custom 404 error page with a clear "Page Not Found" message and a link to return home.
    • Enabled custom 404 handling in the application configuration.
    • Layout now supports a page-level theme attribute, allowing pages (e.g., the 404) to apply a light theme.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 14, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
508-dynamic c48cd6a Commit Preview URL

Branch Preview URL
Feb 14 2026, 04:50 AM

@coderabbitai
Copy link

coderabbitai bot commented Feb 14, 2026

📝 Walkthrough

Walkthrough

Adds a new Astro 404 page and configures asset handling; Layout now accepts an optional data-theme prop and forwards it to the root HTML element.

Changes

Cohort / File(s) Summary
Custom 404 Page
src/pages/404.astro
New Astro page rendering a centered "Page Not Found" view using the existing Layout component, sets page title and data-theme, includes a "Go back home" link, styled with Tailwind classes.
Layout prop update
src/layouts/Layout.astro
Added optional 'data-theme'?: string to the component props and binds it to the <html> element via data-theme={dataTheme}.
Wrangler assets config
wrangler.toml
Added not_found_handling = "404-page" under the [assets] section to enable serving the custom 404 page for missing assets.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I stitched a sign where lost links roam,
A gentle hop to welcome you home.
Tailwind whiskers, a title bright,
Click the button — everything's right! 🏡

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add a 404 page' directly and clearly describes the main change in the pull request, which adds a new custom 404 error page to the application.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-404

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@src/pages/404.astro`:
- Line 5: Layout.astro is dropping the data-theme prop because its Props
interface only defines title; update Layout.astro to accept and pass through the
data-theme attribute by adding "'data-theme'?: string" to the Props interface
(or use Astro's rest operator), extract it from Astro.props (e.g., 'data-theme'
-> dataTheme) and set it on the root html element (the <html> tag) so that the
data-theme passed from pages like 404.astro is preserved.

@michaelmwu michaelmwu merged commit 3a514b9 into main Feb 16, 2026
2 checks passed
@michaelmwu michaelmwu deleted the add-404 branch February 16, 2026 03:01
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.

2 participants