Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add not found page #539

Closed
dns2utf8 opened this issue Jan 13, 2018 · 7 comments
Closed

Add not found page #539

dns2utf8 opened this issue Jan 13, 2018 · 7 comments
Labels
A-HTML Area: HTML Rendering E-Easy Experience: Easy

Comments

@dns2utf8
Copy link

dns2utf8 commented Jan 13, 2018

I noticed while renaming chapters people clicking old urls get a plain 404.

  • Add a 404 page with the current TOC
  • Add an option to generate .htaccess or similar files for deployment
  • Add docs for deployment
@Michael-F-Bryan
Copy link
Contributor

This sounds like a good idea. If a generated 404 page has the TOC down the side then at least people will know what pages are available and find the page's new location.

Resolving this issue should be easy enough to do and would be a good entry-level PR, so I might copy this issue into the TWIR call for participation thread to see if anyone wants to take it.

Rough Outline

From what I can see point 1 should just be a case of generating a blank page towards the end of the HTML renderer's render() method.

You can then add a configuration switch to the output.html table (check out HtmlConfig) which is off by default and enables automatic generation of a .htaccess file. For servers other than Apache we're probably going to have to do it on a case-by-case basis. For example I know The Book is hosted on a S3 bucket, but I've got no idea how you're meant to set the 404 document there.

Point 3 is also fairly straightforward, just document what was done in points 1 and 2 in the user guide.

@azerupi azerupi added E-Easy Experience: Easy A-HTML Area: HTML Rendering labels Jan 26, 2018
@JadedBlueEyes
Copy link

BTW, making the file 404.html would probably be a good idea, as gh-pages, firebase and netlify all use 404.html as the 404 page by default.

@dns2utf8
Copy link
Author

dns2utf8 commented Jan 6, 2019

I implemented something for my website that I am currently extending with a little search engine:
https://estada.ch/2018/11/12/caa-site-configuration-security-and-http2/
The search uses the RSS/XML feed of the generator. Maybe a similar design could work?

@kravemir
Copy link

kravemir commented Mar 9, 2019

Custom error pages are usually easy when developing custom application, and listening to HTTP directly.

However, static site generator generates only static HTML files with resources. And, error pages depend on the server serving the static site. And, those servers might have a different way of defining error pages. And, a server might not respect .htaccess files,..

For example, to define custom error pages for gitlab pages: https://docs.gitlab.com/ee/user/project/pages/introduction.html#custom-error-codes-pages

@JadedBlueEyes
Copy link

Gitlab pages is yet another site that uses 404.html.

manuel-woelker added a commit to manuel-woelker/mdBook that referenced this issue Jun 10, 2020
ehuss added a commit that referenced this issue Jun 23, 2020
@ehuss
Copy link
Contributor

ehuss commented Jun 23, 2020

Closed via #1221.

@ehuss ehuss closed this as completed Jun 23, 2020
@dns2utf8
Copy link
Author

dns2utf8 commented Jun 30, 2020

🎉 I am very happy to see this is implemented now 🎉
Thank you all 👍

Ruin0x11 pushed a commit to Ruin0x11/mdBook that referenced this issue Aug 30, 2020
Ruin0x11 pushed a commit to Ruin0x11/mdBook that referenced this issue Aug 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-HTML Area: HTML Rendering E-Easy Experience: Easy
Projects
None yet
Development

No branches or pull requests

6 participants