For some time now, I’ve wanted the ability to route paths for a GitHub Pages website to its index.html for handling as a single-page app (SPA). This is table-stakes because such apps require all requests to be routed to one HTML file, unless you want to copy the same file across all of your routes every time you make a change to the project. Currently, GitHub Pages doesn’t offer a route-handling solution; the Pages system is intended to be a flat, simple mechanism for serving basic project content.
In case you weren’t aware, GitHub does provide one morsel of customization for your project website: the ability to add a
404.html file and have it served as your custom error page. I took a first stab at an SPA hack simply by duplicating my
index.html file and renaming the copy to
The post S(GH)PA: The Single-Page App Hack For GitHub Pages appeared first on Smashing Magazine.