Skip to content

[FIX]: added fallback page to prevent white HTML page#445

Open
Vatsal-Verma wants to merge 11 commits intoaccordproject:mainfrom
Vatsal-Verma:vatsal/444/fallback-page
Open

[FIX]: added fallback page to prevent white HTML page#445
Vatsal-Verma wants to merge 11 commits intoaccordproject:mainfrom
Vatsal-Verma:vatsal/444/fallback-page

Conversation

@Vatsal-Verma
Copy link
Copy Markdown
Contributor

@Vatsal-Verma Vatsal-Verma commented Jan 7, 2026

note:
This is handling only those pages which are not generated by nunjucks due to any cause. Instead of showing an Empty HTML page, the brower will show this fallback template which will stilll allow you to download for that page archive and other resources associated to that page.

Summary

This change prevents blank HTML pages produced by the static site generator from shipping. It adds a Nunjucks fallback template and a script that scans build/*.html after generation and replaces any pages whose is empty with a readable fallback page containing template metadata and links.
Some of the files show only <html><head></head><body></body></html> after being generated by nunjuck.

Earlier

image

After

image

Method of generation:

Here I have created a fallback template which will be shown if incase the html is not generated by nunjuck.
Here the workflow will do npm run build which will build all the html files, however if in case some html files are not generated then they will be replaced by fallback template

workflow:

Generate pages (normal build)  ---> Run the fixer ---> Scan built HTML files 
 ---> Detect empty page ---> Gather metadata for the fallback --->
 Render the fallback template ---> Overwrite the file

Signed-off-by: Vatsal-Verma <lastav1234@gmail.com>
@Vatsal-Verma
Copy link
Copy Markdown
Contributor Author

@mttrbrts can you please have a look on this :]

Copy link
Copy Markdown

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

Adds a safety net to ensure the generated static site never ships “blank” template pages when Nunjucks generation fails, by replacing empty HTML outputs with a readable fallback page that still exposes key template links/metadata.

Changes:

  • Add a new Nunjucks fallback template (views/fallback.njk) used when a generated page has an empty <body>.
  • Add a post-build script (scripts/fix-empty-pages.js) that scans build/*.html, detects empty pages, and overwrites them with the rendered fallback.
  • Update package.json to run the fixer automatically after npm run build, and expose it as a standalone script.

Reviewed changes

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

File Description
views/fallback.njk New fallback page template rendered for empty/failed template pages.
scripts/fix-empty-pages.js New build-time fixer that detects empty HTML pages and replaces them with the fallback render.
package.json Runs the fixer after build and adds a standalone fix-empty-pages script.

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

Vatsal-Verma and others added 10 commits March 7, 2026 13:30
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Vatsal-Verma <lastav1234@gmail.com>
Signed-off-by: Psychedelics <146416700+Vatsal-Verma@users.noreply.github.com>
Signed-off-by: Vatsal-Verma <146416700+Vatsal-Verma@users.noreply.github.com>
Signed-off-by: Vatsal Verma <146416700+Vatsal-Verma@users.noreply.github.com>
Signed-off-by: Vatsal Verma <146416700+Vatsal-Verma@users.noreply.github.com>
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