Giter VIP home page Giter VIP logo

Comments (8)

adamwathan avatar adamwathan commented on May 23, 2024

Hey David! I wish this was that easy, but since it's a static site it has to be handled at the webserver level. If you use GitHub Pages, you can just create a 404.html file in your root and it will work automatically, otherwise have to configure it in the webserver, and point whatever errors you want to whatever error pages 👍

For anyone else who finds this issue down the road, here's an example of how you might do it with nginx: https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-to-use-custom-error-pages-on-ubuntu-14-04

from jigsaw.

arenowebdev avatar arenowebdev commented on May 23, 2024

Duh. Was way over thinking this one. Thanks!

from jigsaw.

chrisvidal avatar chrisvidal commented on May 23, 2024

Hi i tried ot crate a 404.html in the source folder, but it is not copy over during the build process. Any idea on how to copy this file ?
thanks

EDIT: found it, pipe this line in your gulpfile.js

    .copy( elixir.config.publicPath + '/404.html', 'build_github/404.html')

EDIT:
in the end, it does not copy anything :(

from jigsaw.

adamwathan avatar adamwathan commented on May 23, 2024

I think that's probably an issue of pretty URLs being enabled by default so your file is ending up at /build_github/404/index.html

Might be a way to disable that per page if you're clever 🤔

from jigsaw.

damiani avatar damiani commented on May 23, 2024

@chrisvidal Make sure that .copy line in your gulpfile falls after the .exec line, or else the file that gulp just copied will get deleted at the .exec step. Otherwise, using .copy as you have it should work.

One thing you might change is to append a _ before the filename in source, if you don't need end up with a 404/index.html file in build_github:

.copy( elixir.config.publicPath + '/_404.html', 'build_github/404.html')

from jigsaw.

chrisvidal avatar chrisvidal commented on May 23, 2024

thank @damiani
yes I did this, but the file is not copied neither

whenI follow manually the content of the folder build_github/ I can see the 404.html first then it is removed.
and I have this

    .exec('jigsaw build', ['./source/**/*', '!./source/_assets/**/*'])
    .copy( elixir.config.publicPath + '/_404.html', 'build_github/404.html')

Is it because my command line is like this ?

gulp && jigsaw build github

from jigsaw.

damiani avatar damiani commented on May 23, 2024

Another way you can do it, if you have pretty URLs enabled, is to name your source file 404.html.blade.php. Jigsaw will process it as a normal Blade file (allowing you to use a parent template, for example, just like with any Jigsaw file) and output it to build_github/404.html/index.html, which will be accessible in the browser at 404.html.

from jigsaw.

chrisvidal avatar chrisvidal commented on May 23, 2024

Interesting idea, I am using github pages, let's see if it can support this
EDIT: not working for github pages.

Well i guess i will have to forget the idea of handling the 404 error

from jigsaw.

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.