Coder Social home page Coder Social logo

Comments (7)

rafgraph avatar rafgraph commented on August 17, 2024

Don't put 404.html in the build directory. This repo runs the live demo site - use its structure as a reference.

from spa-github-pages.

ptchiangchloe avatar ptchiangchloe commented on August 17, 2024

Hi

Sorry, I changed it and I still have the same problem, I'm thinking maybe this is not working?

Thanks

from spa-github-pages.

rafgraph avatar rafgraph commented on August 17, 2024

Nope, the example site works fine. Issue is on your end.

Read the GitHub docs https://help.github.com/categories/github-pages-basics/ the instructions here are not a substitute for the github docs.

My suggestion would be to clone this repo and follow the detailed instructions to get the example site working with your account before making any changes to the code and content.

from spa-github-pages.

ptchiangchloe avatar ptchiangchloe commented on August 17, 2024

I'm not saying your app doesn't work, however, your code is not working my app, since I got 404 from Github and the same error before I add your code.

from spa-github-pages.

rafgraph avatar rafgraph commented on August 17, 2024

It sounds like you're having an issue with loading a custom 404 page.
https://help.github.com/articles/creating-a-custom-404-page-for-your-github-pages-site/

Make sure 404.html is present in the root of the branch that is being served by GitHub pages, which in your case should be the gh-pages branch - that's where GitHub pages will look for a custom 404 page, if it doesn't find it it will serve it's standard 404 page, which I think is what's happening.

from spa-github-pages.

rafgraph avatar rafgraph commented on August 17, 2024

Also, if you're using it with a project pages site without a custom domain, i.e. https://ptchiangchloe.github.io/portfolio-site, make sure to set segmentCount = 1 here so /portfolio-site will remain in the path after the redirect.

from spa-github-pages.

rafgraph avatar rafgraph commented on August 17, 2024

It looks like you're using the gh-pages npm package to create your gh-pages branch from your master branch. In this case you need to have the 404 file in the public directory on your master branch so it ends up in the root of your gh-pages branch.

For someone who is starting out my suggestion would be to use as little tooling as possible to really understand what's happening so you don't run into issues like this one, and then slowly add more tooling. That is, just create your site in the gh-pages branch and not use the gh-pages npm package. Tooling is great, but can cause a lot of frustrating issues if you're a beginner and don't understand what it's doing.

from spa-github-pages.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.