Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Replace 4xx.html and 5xx.html with a single error.html page? #209

Closed
Rich-Harris opened this issue Mar 19, 2018 · 3 comments
Closed

Replace 4xx.html and 5xx.html with a single error.html page? #209

Rich-Harris opened this issue Mar 19, 2018 · 3 comments

Comments

@Rich-Harris
Copy link
Member

For me these files are normally identical. Maybe that's not true for everyone?

Also, it might need a 'special' name that isn't just error.html, since you might want to use that as a route.

@s0kil
Copy link

s0kil commented Mar 20, 2018

@Rich-Harris
Is there a way to render an error page?
Ex.

export default {
  components: {
    Layout
  },

  preload({ params, query }) {
    // the `slug` parameter is available because this file
    // is called [slug].html
    const { slug } = params;

    let api = `//192.168.44.62:8000/${slug || "/"}/?api`;

    return fetch(api)
      .then(r => r.json())
      .then(post => {
        if (post.name === "notfound.md") {
          goto("error_page");
        } else {
          return {
            post
          };
        }
      });
  }
};

@s0kil
Copy link

s0kil commented Mar 20, 2018

return this.redirect(404, '/error');

@Rich-Harris
Copy link
Member Author

This is fixed in 0.14

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants