Skip to content

feat: add 404 Not Found page with custom styling and translations#279

Merged
danielmarv merged 2 commits intonext-js-migrationfrom
239-newsletter-page-rendering-and-functionality
Feb 16, 2026
Merged

feat: add 404 Not Found page with custom styling and translations#279
danielmarv merged 2 commits intonext-js-migrationfrom
239-newsletter-page-rendering-and-functionality

Conversation

@danielmarv
Copy link
Member

This pull request introduces a new custom 404 "Not Found" page with enhanced visuals and internationalization support, and adds documentation to guide contributors in adding new pages with localization.

User-facing feature:

  • Added a new not-found.tsx page under src/app/[locale]/ that displays a custom 404 page with illustrations, localized text, and a prominent link back to the homepage. The page supports both English and German via next-intl and uses next/image for optimized images. (src/app/[locale]/not-found.tsxR1-R47)

Documentation:

  • Updated README.md to include a link to an "Adding New Pages" guide (ADDING_PAGES.md), which explains how to add new pages with EN/DE versions, image handling, and layout options.

@danielmarv danielmarv self-assigned this Feb 16, 2026
Copilot AI review requested due to automatic review settings February 16, 2026 14:30
@danielmarv danielmarv force-pushed the 239-newsletter-page-rendering-and-functionality branch from d9b4abe to 180f494 Compare February 16, 2026 14:31
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a custom 404 Not Found page with internationalization support and comprehensive documentation for adding new pages to the Open Elements website.

Changes:

  • New custom 404 page component with localized content, styled with Tailwind CSS and optimized images
  • Added comprehensive "Adding New Pages" documentation covering page creation, markdown structure, layouts, images, and troubleshooting
  • Updated README to reference the new documentation guide

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/app/[locale]/not-found.tsx New 404 page component with custom styling, illustrations, and internationalized text using next-intl
ADDING_PAGES.md Comprehensive 424-line guide documenting how to add new pages with EN/DE versions, markdown frontmatter, layouts, images, and troubleshooting
README.md Added link to the new "Adding New Pages Guide" in the Documentation section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

</div>
</div>
<div className="relative inline">
<span>{t('404.notFound')}</span>
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The translation key '404.notFound' is incorrect. According to the translation files (locales/en.json and locales/de.json), the key is just 'notFound' at the root level, not nested under '404'. This should be changed to t('notFound') to match the actual translation structure.

Suggested change
<span>{t('404.notFound')}</span>
<span>{t('notFound')}</span>

Copilot uses AI. Check for mistakes.
Comment on lines +177 to +181
#### Notes on Page Components:
- Use the `locale` parameter to render different content for EN/DE
- Use `notFound()` if a locale isn't supported: `if (locale !== 'de') { notFound() }`
- Import and use shared components from `src/components/`
- Follow existing pages for styling patterns (Tailwind CSS)
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The documentation should include guidance on when to use client components with the 'use client' directive, particularly for pages that need the useTranslations hook from next-intl. The template provided shows a server component pattern, but doesn't explain when a client component is needed. This is especially relevant since the 404 page added in this PR uses useTranslations and requires 'use client'. Consider adding a section or note explaining the difference between server and client component patterns for pages, including when to use useTranslations versus hardcoding localized strings.

Copilot uses AI. Check for mistakes.
width={224}
height={100}
/>
<span className="relative">Ooops - </span>
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The text "Ooops - " is hardcoded in English and not internationalized. While this might be intentional (as "Oops" is commonly used in German contexts), it's inconsistent with the page's approach of using translations for other text elements. Consider adding this to the translation files (e.g., as 'oops' key) to maintain consistency with the internationalization pattern used throughout the page.

Suggested change
<span className="relative">Ooops - </span>
<span className="relative">{t('oops')}</span>

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,47 @@
import Image from 'next/image'
import Link from 'next/link'
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

The component imports Link from 'next/link', but should use the localized Link from '@/i18n/routing' instead. The codebase convention (as seen in Navbar.tsx and Footer.tsx) is to use the localized Link which properly handles locale prefixes. Without this, the home link may not correctly navigate to the German homepage when the user is on the German 404 page.

Suggested change
import Link from 'next/link'
import Link from '@/i18n/routing'

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +3
import Image from 'next/image'
import Link from 'next/link'
import { useTranslations } from 'next-intl'
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

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

This component is missing the 'use client' directive at the top of the file. All pages that use the useTranslations hook from next-intl must be client components and include 'use client' at the very first line. Without this directive, the component will fail to render properly because hooks can only be used in client components.

Copilot uses AI. Check for mistakes.
Signed-off-by: Daniel Ntege <danientege785@gmail.com>
…rman

Signed-off-by: Daniel Ntege <danientege785@gmail.com>
@danielmarv danielmarv force-pushed the 239-newsletter-page-rendering-and-functionality branch from f41203e to 5496978 Compare February 16, 2026 15:10
@danielmarv danielmarv merged commit ce6d2a4 into next-js-migration Feb 16, 2026
2 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Migration to NextJS Feb 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant