[FIX]: added fallback page to prevent white HTML page#445
Open
Vatsal-Verma wants to merge 11 commits intoaccordproject:mainfrom
Open
[FIX]: added fallback page to prevent white HTML page#445Vatsal-Verma wants to merge 11 commits intoaccordproject:mainfrom
Vatsal-Verma wants to merge 11 commits intoaccordproject:mainfrom
Conversation
Signed-off-by: Vatsal-Verma <lastav1234@gmail.com>
Contributor
Author
|
@mttrbrts can you please have a look on this :] |
There was a problem hiding this comment.
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 scansbuild/*.html, detects empty pages, and overwrites them with the rendered fallback. - Update
package.jsonto run the fixer automatically afternpm 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.
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>
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.
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
After
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 buildwhich will build all the html files, however if in case some html files are not generated then they will be replaced by fallback templateworkflow: