Skip to content

Add configurable custom 404 page generation (GitHub Pages compatible) - #29

Draft
bsstahl with Copilot wants to merge 3 commits into
masterfrom
copilot/add-custom-404-page
Draft

Add configurable custom 404 page generation (GitHub Pages compatible)#29
bsstahl with Copilot wants to merge 3 commits into
masterfrom
copilot/add-custom-404-page

Conversation

Copilot AI commented May 6, 2026

Copy link
Copy Markdown

Adds opt-in generation of a static 404.html at the site root, compatible with GitHub Pages custom 404 page conventions. Default behavior is unchanged — the page is only generated when Generate404Page: true is set in site configuration.

Changes

Core model & enum

  • SiteSettings.Generate404Page — new bool property, defaults to false
  • TemplateType.NotFound — new enum value to identify 404 output files

New generator (PPTail.Generator.NotFound)

  • INotFoundProvider interface with Generate404Page() method
  • NotFoundProvider implementation generates self-contained HTML from site settings (Title, Description, Copyright) with proper HTML encoding — no template required per design

Site builder

  • Builder now validates INotFoundProvider is registered and conditionally emits ./404.html when siteSettings.Generate404Page is true

Configuration

  • YamlSiteSettings (MediaBlog) and Forestry.SiteSettings updated to deserialize and map the new property

Enabling the feature

In your SiteSettings.md YAML front matter:

Generate404Page: true

Tests

  • 2 constructor dependency tests for INotFoundProvider
  • 6 build tests covering enabled/disabled behavior, output filename, content passthrough, and provider invocation count

Copilot AI linked an issue May 6, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits May 6, 2026 18:06
- Add Generate404Page property to SiteSettings (default: false)
- Add NotFound to TemplateType enum
- Create INotFoundProvider interface
- Create PPTail.Generator.NotFound project with static HTML generator
- Update Builder.cs to conditionally generate 404.html when enabled
- Update SiteSettingsBuilder with Generate404Page method
- Update YamlSiteSettings and Forestry SiteSettings to include Generate404Page
- Update test Extensions.cs to include INotFoundProvider mock
- Add comprehensive tests for 404 page generation behavior
- Add NotFound project to solution file

Agent-Logs-Url: https://github.com/bsstahl/PPTail/sessions/924d3052-a419-4b3a-8ce5-e713f3c7f35d

Co-authored-by: bsstahl <8053235+bsstahl@users.noreply.github.com>
Copilot AI changed the title [WIP] Add a custom 404 page generation feature Add configurable custom 404 page generation (GitHub Pages compatible) May 6, 2026
Copilot finished work on behalf of bsstahl May 6, 2026 18:11
Copilot AI requested a review from bsstahl May 6, 2026 18:11
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.

Add a Custom 404 Page

2 participants