Skip to content

Commit 5b74110

Browse files
committed
ui: add 404 page
1 parent 82cef1d commit 5b74110

File tree

9 files changed

+49
-2
lines changed

9 files changed

+49
-2
lines changed

languages/en.yml

+1
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ comment:
9999
reload: Click to reload
100100
loading: Loading comment plugin
101101
config_error: "Please fill in the required configuration items for %s comment plugin"
102+
page_not_found: Page Not Found

languages/zh-CN.yml

+1
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ comment:
9999
reload: 点击重新加载
100100
loading: 正在加载评论插件
101101
config_error: "请完整填写 %s 评论插件必需的配置项"
102+
page_not_found: 页面找不到

languages/zh-TW.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,5 @@ comment:
9898
fail_tip: 評論插件加載失敗
9999
reload: 點擊重新加載
100100
loading: 正在加載評論插件
101-
config_error: "請完整填寫 %s 評論插件必需的配置項"
101+
config_error: "請完整填寫 %s 評論外掛程式必需的設定項"
102+
page_not_found: 頁面缺失

layout/404.ejs

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div class="fade-in-down-animation">
2+
<div class="error-404-container border-box">
3+
<div class="text-1 border-box flex-center">404</div>
4+
<div class="text-2 border-box flex-center">
5+
<%- __('page_not_found') %>
6+
</div>
7+
</div>
8+
</div>

layout/page.ejs

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
4444
<%- partial('_partial/tagcloud') %>
4545
46+
<% } else if (page.type === '404') { %>
47+
48+
<%- partial('404') %>
49+
4650
<% } else { %>
4751
4852
<%- partial('page-template') %>

scripts/events/generate-404-page.js

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* global hexo */
2+
3+
'use strict'
4+
5+
hexo.extend.generator.register('generate-404-page', function () {
6+
return {
7+
path: '404.html',
8+
layout: ['page'],
9+
data: {
10+
type: '404',
11+
title: '404'
12+
}
13+
}
14+
})

source/css/layout/404.styl

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.error-404-container {
2+
.text-1 {
3+
width 100%
4+
height 10rem
5+
color var(--text-color-3)
6+
font-weight 600
7+
font-size 10rem
8+
}
9+
10+
.text-2 {
11+
width 100%
12+
height 3rem
13+
color var(--text-color-4)
14+
font-size 2rem
15+
letter-spacing 1px
16+
}
17+
}

source/css/style.styl

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
@import "layout/_partial/archive-list.styl"
1818
@import "layout/_partial/footer.styl"
1919
@import "layout/_partial/paginator.styl"
20-
@import "layout/_partial/page-template.styl"
2120
@import "layout/_partial/first-screen.styl"
2221
@import "layout/_partial/image-mask.styl"
2322
@import "layout/category-list.styl"
@@ -28,6 +27,8 @@
2827
@import "layout/article-content.styl"
2928
@import "layout/category-content.styl"
3029
@import "layout/tag-content.styl"
30+
@import "layout/404.styl"
31+
@import "layout/page-template.styl"
3132
@import "layout/_partial/tagcloud.styl"
3233
@import "layout/_partial/common/empty-content.styl"
3334
@import "layout/_partial/post/post-share.styl"

0 commit comments

Comments
 (0)