Skip to content

Commit f307b7a

Browse files
committed
Add a custom 404 page
1 parent 1e042e5 commit f307b7a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

404.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# 404 Not Found | Rustの日本語ドキュメント
2+
3+
---
4+
title: "404 Not Found | Rustの日本語ドキュメント/Japanese Docs for Rust"
5+
permalink: /404.html
6+
---
7+
8+
9+
## 404 Not Found
10+
11+
<div id="suggestion">
12+
お探しのページは存在しません。
13+
[トップページ](https://doc.rust-jp.rs)からご利用ください。
14+
</div>
15+
16+
<script>
17+
var base_url = 'https://doc.rust-jp.rs';
18+
// var rbe_old = '/rust-by-example-ja/rust-by-example/';
19+
var rbe_old = '/rust-by-example-ja/rust-by-example-test/';
20+
var rbe_new = '/rust-by-example-ja/'
21+
22+
var href = location.href;
23+
var path = location.pathname;
24+
var redirect_to = '';
25+
26+
if (path.startsWith(rbe_old)) {
27+
redirect_to = href.replace(rbe_old, rbe_new);
28+
}
29+
30+
if (redirect_to != '') {
31+
var elem = document.getElementById('suggestion');
32+
elem.innerHTML = '<p>お探しのページは移動したようです。こちらのURLをお試しください。</br>'
33+
elem.innerHTML += '<a href="' + redirect_to + '">' + redirect_to + '</a></p>';
34+
elem.innerHTML += '<p>または、このサイトの<a href="' + base_url + '">トップページ</a>をご利用ください。</p>'
35+
}
36+
</script>

0 commit comments

Comments
 (0)