Skip to content

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

@Vatsal-Verma

Description

@Vatsal-Verma

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.

Why

Some templates fail to render their README/assets and result in files like:

. These blank pages are confusing for users and break the browsing experience on the hosted library.

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

PR : #445

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions