Skip to content

Commit 0ead636

Browse files
authored
feat(404): improve 404 page (#253)
1 parent a06a30b commit 0ead636

File tree

4 files changed

+137
-4
lines changed

4 files changed

+137
-4
lines changed

i18n/en/code.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
{
22
"theme.NotFound.title": {
3-
"message": "Page Not Found",
3+
"message": "404 :(",
44
"description": "The title of the 404 page"
55
},
66
"theme.NotFound.p1": {
7-
"message": "We could not find what you were looking for.",
8-
"description": "The first paragraph of the 404 page"
7+
"message": "Sorry, the page doesn't exist or has moved.",
8+
"description": "The 1st paragraph of the 404 page"
99
},
1010
"theme.NotFound.p2": {
11-
"message": "Please contact the owner of the site that linked you to the original URL and let them know their link is broken.",
11+
"message": "Let's go back to the {homepage}.",
1212
"description": "The 2nd paragraph of the 404 page"
1313
},
14+
"theme.NotFound.homepageLink": {
15+
"message": "homepage",
16+
"description": "Label for the link to the homepage"
17+
},
18+
"theme.NotFound.p3": {
19+
"message": "Wokwi is an online electronics simulator, which can be used to simulate {Arduino}, {ESP32}, {STM32} & {Pico} projects, with support for many other popular boards and components. Get started for free at {wokwiWebsite}.",
20+
"description": "A paragraph describing what Wokwi offers"
21+
},
1422
"theme.AnnouncementBar.closeButtonAriaLabel": {
1523
"message": "Close",
1624
"description": "The ARIA label for close button of announcement bar"
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import React from 'react';
2+
import clsx from 'clsx';
3+
import Translate from '@docusaurus/Translate';
4+
import Heading from '@theme/Heading';
5+
import Link from '@docusaurus/Link';
6+
7+
import WokwiCat from '/static/img/wokwi-cat.svg';
8+
9+
export default function NotFoundContent({className}) {
10+
return (
11+
<main className={clsx('container margin-vert--xl', className)}>
12+
<div className="row">
13+
<div className="col col--6 col--offset-3">
14+
<Heading as="h1" className="hero__title">
15+
<Translate
16+
id="theme.NotFound.title"
17+
description="The title of the 404 page">
18+
404 :(
19+
</Translate>
20+
</Heading>
21+
<p>
22+
<Translate
23+
id="theme.NotFound.p1"
24+
description="The 1st paragraph of the 404 page">
25+
Sorry, the page doesn't exist or has moved.
26+
</Translate>
27+
&nbsp;
28+
<Translate
29+
id="theme.NotFound.p2"
30+
description="The 2nd paragraph of the 404 page"
31+
values={{
32+
homepage: (
33+
<Link to="/">
34+
<Translate
35+
id="theme.NotFound.homepageLink"
36+
description="Label for the link to the homepage">
37+
homepage
38+
</Translate>
39+
</Link>
40+
)
41+
}}>
42+
Let's go back to the homepage.
43+
</Translate>
44+
</p>
45+
<p>
46+
<Translate
47+
id="theme.NotFound.p3"
48+
description="A paragraph describing what Wokwi offers"
49+
values={{
50+
Arduino: <Link to="https://wokwi.com/arduino">Arduino</Link>,
51+
ESP32: <Link to="https://wokwi.com/esp32">ESP32</Link>,
52+
STM32: <Link to="https://wokwi.com/stm32">STM32</Link>,
53+
Pico: <Link to="https://wokwi.com/pi-pico">Pico</Link>,
54+
wokwiWebsite: <Link to="https://wokwi.com">wokwi.com</Link>
55+
}}>
56+
</Translate>
57+
</p>
58+
59+
<div style={{display: 'flex', justifyContent: 'center'}}>
60+
<WokwiCat style={{fill: 'currentColor'}}/>
61+
</div>
62+
63+
</div>
64+
</div>
65+
</main>
66+
);
67+
}

src/theme/NotFound/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import {translate} from '@docusaurus/Translate';
3+
import {PageMetadata} from '@docusaurus/theme-common';
4+
import Layout from '@theme/Layout';
5+
import NotFoundContent from '@theme/NotFound/Content';
6+
export default function Index() {
7+
const title = translate({
8+
id: 'theme.NotFound.title',
9+
message: 'Page Not Found',
10+
});
11+
return (
12+
<>
13+
<PageMetadata title={title} />
14+
<Layout>
15+
<NotFoundContent />
16+
</Layout>
17+
</>
18+
);
19+
}

static/img/wokwi-cat.svg

Lines changed: 39 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)