Fluid 修改404页面

Fluid 修改404页面

我们可以在node_modules\hexo-theme-fluid\layout\404.ejs找到 Fluid 的官方layout。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<%
page.layout = "404"
page.title = theme.page404.title || __('page404.title')
page.subtitle = theme.page404.subtitle || __('page404.subtitle')
page.banner_img = theme.page404.banner_img
page.banner_img_height = theme.page404.banner_img_height
page.banner_mask_alpha = theme.page404.banner_mask_alpha
%>

<script>
function redirect() {
location.href = "<%- url_for('/') %>";
}
<% if (theme.page404.redirect_delay) { %>
setTimeout(redirect, <%= parseInt(theme.page404.redirect_delay) %>)
<% } %>
</script>

根据文件,我们可以看出来404页面是在_config.fluid.yml中的page404字段下配置,例如:

1
2
3
4
5
# 404页
page404:
banner_img: https://example.com/example.jpg
banner_img_height: 100%
banner_mask_alpha: 0.05

Fluid 修改404页面
https://flowerdown.org/posts/20250402-141231.html
作者
Unrealfeather
发布于
2025年4月2日
许可协议