websemantics / gh-pages-spa

Easy way to enable Single Page Applications for GitHub Pages
https://websemantics.github.io/gh-pages-spa/
40 stars 17 forks source link

Providing the script path to index.html and 404.html #3

Open aldokkani opened 5 years ago

aldokkani commented 5 years ago

<script type="text/javascript" src="../node_modules/ghspa/ghspa.js"></script> After you build your app this path won't exist.

antoniandre commented 4 years ago

Yes, you have to copy the script at the root of your project.


I really like this project @websemantics and I think the documentation is not clear enough. Investigating the code made me understand the principle and get it to work.

I think what is important to mention in docs is:

  1. Copy the ghspa.js script at the root of your Github SPA project.
  2. Create a 404.html that has a link to this script <script type="text/javascript" src="ghspa.js"></script> AND a 404 title
  3. You must have an index.html file (I use vue-cli) and it should also link to the ghspa script <script type="text/javascript" src="ghspa.js"></script>

Both 404.html and index.html must include the script as the its function will redirect from the 404 page and resolve the redirected link when landing on index.html.


Apart from that, good work @websemantics!