Skip to content

Commit 5479ac8

Browse files
committed
v1.0.0
Refactored project structure, added `package.json`, build scripts, and updated `.gitignore`. Improved asset organization and renamed files for better clarity. Updated `README.md` with installation and usage instructions. Signed-off-by: Kolja Nolte <kolja.nolte@gmail.com>
1 parent 0bf4b52 commit 5479ac8

29 files changed

+87
-96
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
.DS_Store
22
.idea/
3+
*.zip
4+
node_modules/
5+
dist/

README.md

Lines changed: 59 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
![GitHub Release](https://img.shields.io/github/v/release/thaikolja/modern-html-error-docs?include_prereleases&display_name=release&style=flat&color=light-blue&link=https%3A%2F%2Fgithub.com%2Fthaikolja%2Fmodern-html-error-docs) ![GitHub forks](https://img.shields.io/github/forks/thaikolja/modern-html-error-docs?style=flat) ![GitHub Repo stars](https://img.shields.io/github/stars/thaikolja/modern-html-error-docs?style=flat&color=dark-green) ![License](https://img.shields.io/badge/License-MIT-yellow.svg)
44

5-
A collection of modern, responsive, and brandable [HTML error pages](https://www.presslabs.com/how-to/error-pages/) (e.g., `404`, `500`) designed to turn frustrating moments into memorable, on-brand experiences—with an optional dose (customizable) of sarcasm, irony, and humor. Built for server administrators who are bored with the default Apache/Nginx error docs. This repository is hosted on [GitLab](https://gitlab.com/thaikolja/modern-html-error-docs) and mirrored to [GitHub](https://github.com/thaikolja/modern-html-error-docs).
5+
A collection of modern, responsive, and brandable [HTML error pages](https://www.presslabs.com/how-to/error-pages/) (e.g., `404`, `500`) designed to turn frustrating moments into memorable, on-brand experiences—with an optional dose (customizable) of sarcasm, irony, and humor. Built for server administrators who are bored with the default Apache/Nginx error docs.
6+
7+
This repository is hosted on [GitLab](https://gitlab.com/thaikolja/modern-html-error-docs) and mirrored to [GitHub](https://github.com/thaikolja/modern-html-error-docs).
8+
9+
---
610

711
**Example for the error code 503:**
812

9-
![screenshot](https://p.ipic.vip/k018xl.jpg)
13+
![screenshot](https://p.ipic.vip/zfu3jm.jpg)
1014

1115
## Features
1216

@@ -17,129 +21,101 @@ A collection of modern, responsive, and brandable [HTML error pages](https://www
1721
- 🧹 **Organized Structure:** Clear separation of CSS, JavaScript, and image assets.
1822
- ⚒️ **Customizable:** Easily modify docs, styling, and robot images to match your brand.
1923

20-
## Getting Started
21-
22-
Although the error docs have been built for Linux servers, please note that the following paths and folders may not be accurate for your specific distribution.
24+
## Requirements
2325

24-
### Requirements
25-
26-
- A server running Linux
27-
- An installed web server, e.g., Apache or Nginx
28-
- Access to your server's standard error docs files
26+
- Server running Linux
27+
- Installed web server, e.g., Apache or Nginx
28+
- Access to your server's (standard) error docs files, e.g., root access
2929

3030
## Installation
3131

32-
> [!NOTE]
32+
> [!WARNING]
3333
>
34-
> For this installation, a Debian 12 server running Plesk, Apache, and Nginx is used. Some file paths may differ from those in your distribution.
34+
> Although the error docs have been built for Linux servers, please note that the following paths and folders **may not be accurate for your specific distribution.**
3535
3636
### Install from Build
3737

38-
An **already built version** with minified assets and only the necessary files that need to be moved to the server.
38+
Download the pre-built version with minified assets and only the necessary files that need to be transferred to the server.
3939

4040
1. Use SSH to log in to your server as a user with enough permission (see: "Requirements")
4141

42-
2. Change into the directory where the error message files are being stored. In this case, it's the following directory for **new domains**. Already existing domains are located in `/var/www/vhosts/DOMAIN.COM/error-docs`.
42+
2. Find the directory that stores the server's default error docs (example: `/var/www/error-docs`) and `cd` into this directory
4343

44-
```bash
45-
cd /var/www/vhosts/.skel/0
46-
```
44+
3. Head to the "Release" section on [GitLab](https://gitlab.com/thaikolja/modern-html-error-docs/-/releases) or [GitHub](https://github.com/thaikolja/modern-html-error-docs/releases) and copy the URL of **the latest version's .zip file** named `error-docs-built.zip`
4745

48-
3. Create a backup of the default error docs folder:
46+
4. Create a backup of the already existing files:
4947

5048
```bash
51-
zip -r error-docs-backup.zip error_docs
49+
cp -r error-docs error-docs_backup
5250
```
5351

54-
4. Head to the "Release" section on GitLab or GitHub and copy the URL of the latest version's .zip file:
52+
5. Unzip the downloaded archive and set permissions:
5553

5654
```bash
57-
# Using wget
58-
wget https://github.com/thaikolja/modern-html-error-docs/archive/refs/heads/main.zip
59-
60-
# Using curl
61-
curl -0 https://github.com/thaikolja/modern-html-error-docs/archive/refs/heads/main.zip
55+
sudo unzip error-docs-built.zip -d /var/www/error-docs
56+
sudo chown -R www-data:www-data /var/www/error-docs
57+
sudo chmod -R 0755 /var/www/error-docs
6258
```
6359

64-
5. Unzip the downloaded file `main.zip`:
60+
6. If the error docs hadn't been set, activate them on your web server:
6561

66-
```bash
67-
unzip dist.zip
68-
```
62+
1. #### Apache
6963

70-
6. Backup your existing default `error-docs` and rename your extracted `dist`:
64+
```bash
65+
ErrorDocument 404 /var/www/error-docs/not_found.html
66+
ErrorDocument 500 /var/www/error-docs/internal_server_error.html
67+
# etc.
68+
```
7169

72-
```bash
73-
mv error-docs ./error-docs_backup && mv dist error-docs
74-
```
70+
2. #### Nginx
7571

76-
7. `cd` into `error-docs` and use `ls -l` (or `tree`, if available). You should see the following file structure:
72+
```nginx
73+
error_page 404 /errors/my-brand/not_found.html;
74+
location = /errors/my-brand/not_found.html {
75+
internal;
76+
alias /var/www/errors/my-brand/not_found.html;
77+
}
78+
# etc.
79+
```
7780

78-
```bash
79-
├── assets
80-
│ ├── css
81-
│ │ └── main.min.css
82-
│ ├── data
83-
│ │ └── docs.json
84-
│ ├── img
85-
│ │ ├── robot-blue.avif
86-
│ │ ├── robot-blue.png
87-
│ │ ├── robot-blue.webp
88-
│ │ ├── robot-red.avif
89-
│ │ ├── robot-red.png
90-
│ │ ├── robot-red.webp
91-
│ │ ├── robot-yellow.avif
92-
│ │ ├── robot-yellow.png
93-
│ │ └── robot-yellow.webp
94-
│ └── js
95-
│ └── scripts.min.js
96-
├── bad_gateway.html
97-
├── bad_request.html
98-
├── forbidden.html
99-
├── internal_server_error.html
100-
├── maintenance.html
101-
├── method_not_allowed.html
102-
├── not_acceptable.html
103-
├── not_found.html
104-
├── not_implemented.html
105-
├── precondition_failed.html
106-
├── proxy_authentication_required.html
107-
├── request-uri_too_long.html
108-
├── unauthorized.html
109-
└── unsupported_media_type.html
110-
```
81+
3. #### Plesk
82+
83+
1. Upload the built files into `httpdocs` or a subfolder
84+
2. Enable "Custom error documents" in Domains → Hosting Settings, or use the Plesk CLI/API so your changes survive vhost regeneration
11185

112-
8. To change the docs for each template, open `assets/data/docs.json` and adjust them there.
86+
### Install via Git
11387

114-
9. Restart your Apache or Nginx server or create a new website in your Plesk interface:
88+
1. Clone this repository:
11589

11690
```bash
117-
# Apache
118-
sudo systemctl restart apache2
119-
120-
# Nginx
121-
sudo systemctl restart nginx
91+
git clone https://gitlab.com/thaikolja/modern-html-error-docs.git
12292
```
12393

124-
10. 🥳 Your Modern HTML Error Docs are successfully installed!
94+
2. `cd` into the directory:
12595

126-
### Via Git
96+
```bash
97+
cd modern-html-error-docs
98+
```
12799

128-
1. Clone the main repository with unminified codes:
100+
3. Install necessary packages to build the distribution package:
129101

130102
```bash
103+
npm i
104+
# or `yarn`, `bun i`, or whatever package manager you prefer
131105
```
132106

133-
2. Apply your changes.
107+
4. Build the package:
134108

135-
3. Clea
109+
```bash
110+
npm run package # or with other package managers
111+
```
112+
113+
5. Use the content `dist/` folder to replace your error docs.
136114

137115
## Customization
138116

139117
### Messages and Texts
140118

141-
These error docs
142-
143119
All error docs are stored in `assets/data/docs.json`. You can edit this file to change the titles, descriptions, and robot speech for each error code.
144120

145121
```json
@@ -157,32 +133,20 @@ All error docs are stored in `assets/data/docs.json`. You can edit this file to
157133

158134
### Styling
159135

160-
Modify the `assets/css/main.css` file to change the visual appearance of the error pages. The CSS uses nesting for better readability and maintainability.
136+
Modify the **source** `assets/css/main.css` file to change the visual appearance of the error pages. The CSS uses nesting for better readability and maintainability.
161137

162138
### Images
163139

164140
Replace or add new robot images in the `assets/img/` directory. Ensure you update the `srcset` and `src` attributes in the respective HTML files if you change the image filenames.
165141

166142
### JavaScript
167143

168-
The `assets/js/scripts.js` file handles the dynamic loading of docs from `docs.json` and can be extended for additional client-side functionality.
169-
170-
## What's Next
171-
172-
* Creating a way of easier deployment
173-
* Accurate Linux distribution determination
174-
* Expanding `README.md` for the most used Linux distributions
144+
The `assets/js/scripts.js` file handles the dynamic loading of docs from `docs.json` and can be extended for additional client-side functionality (use the **source file** from the repository).
175145

176146
## Contributing
177147

178148
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
179149

180-
1. Fork the Project
181-
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
182-
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
183-
4. Push to the Branch (`git push origin feature/AmazingFeature`)
184-
5. Open a Pull Request
185-
186150
## Author
187151

188152
* Kolja Nolte (kolja.nolte@gmail.com)

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "modern-html-error-docs",
3+
"description": "A modern, responsive HTML error documentation template.",
4+
"author": "Kolja Nolte",
5+
"license": "MIT",
6+
"version": "1.0.0",
7+
"private": true,
8+
"scripts": {
9+
"clean": "rm -rf dist error-docs-built.zip",
10+
"prepare-dist": "mkdir -p dist/assets/css dist/assets/js dist/assets/img dist/assets/data",
11+
"build:css": "npx postcss src/assets/css/main.css --use cssnano -o dist/assets/css/main.css",
12+
"build:js": "npx esbuild src/assets/js/scripts.js --bundle --minify --outfile=dist/assets/js/scripts.js --format=esm",
13+
"copy:assets": "cp -r src/assets/img dist/assets/ || true && cp -r src/assets/data dist/assets/ || true",
14+
"copy:html": "cp src/*.html dist/ || true",
15+
"build": "npm run clean && npm run prepare-dist && npm run build:css && npm run build:js && npm run copy:assets && npm run copy:html",
16+
"package": "npm run build && (cd dist && zip -r ../error-docs-built.zip . -x \"**/*.map\")"
17+
},
18+
"devDependencies": {
19+
"esbuild": "^0.25.9",
20+
"postcss": "^8.5.6",
21+
"postcss-cli": "^11.0.1",
22+
"cssnano": "^7.1.1"
23+
}
24+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)