Skip to content

Commit e0508cf

Browse files
authored
Fix missing redirects (#1640)
* add a simple 404 * fix redirects for language links * activate prism to fix highlighting
1 parent 5f41974 commit e0508cf

4 files changed

Lines changed: 60 additions & 15 deletions

File tree

website/pages/en/404.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const React = require("react");
2+
3+
const CompLibrary = require("../../core/CompLibrary");
4+
5+
const Container = CompLibrary.Container;
6+
7+
function NotFound() {
8+
return (
9+
<div className="docMainWrapper wrapper">
10+
<Container className="mainContainer documentContainer postContainer">
11+
<div className="post">
12+
<header className="postHeader">
13+
<h1>Not Found</h1>
14+
</header>
15+
The page you are looking for does not exist.
16+
</div>
17+
</Container>
18+
</div>
19+
);
20+
}
21+
22+
module.exports = NotFound;

website/pages/en/index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const React = require("react");
2+
3+
const CompLibrary = require("../../core/CompLibrary");
4+
5+
const Container = CompLibrary.Container;
6+
7+
function Home(props) {
8+
const { config, language } = props;
9+
const langPath = language ? language + "/" : "";
10+
const href = `${config.baseUrl}${config.docsUrl}/${langPath}`;
11+
12+
return (
13+
<div className="docMainWrapper wrapper">
14+
{/* not ideal, but it's the best we can do with Docusaurus v1 */}
15+
<script
16+
dangerouslySetInnerHTML={{
17+
__html: `window.location.href = "${href}";`,
18+
}}
19+
></script>
20+
<Container className="mainContainer documentContainer postContainer">
21+
<div className="post">
22+
<header className="postHeader">
23+
<h1>Redirecting</h1>
24+
</header>
25+
<div>
26+
{/* please note the trailing space */}
27+
{"If you are not redirected automatically, follow this "}
28+
<a href={href}>link</a>.
29+
</div>
30+
</div>
31+
</Container>
32+
</div>
33+
);
34+
}
35+
36+
module.exports = Home;

website/siteConfig.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ const siteConfig = {
7171
// Highlight.js theme to use for syntax highlighting in code blocks.
7272
theme: 'default',
7373
},
74+
// prism manages to actually highlight our code properly
75+
usePrism: ["rust"],
7476

7577
// Add custom scripts here that would be placed in <script> tags.
7678
// scripts: ['https://buttons.github.io/buttons.js'],

website/static/index.html

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)