去掉404模板,不用依赖发布404页面也可以跳转404页面

This commit is contained in:
1152958806@qq.com 2023-07-14 01:59:13 +08:00
parent 3a2f7b3255
commit 36d4338368
5 changed files with 5 additions and 26 deletions

View File

@ -1905,26 +1905,12 @@ spec:
value:
subtitle:
background:
error_404Enable:
children:
- $formkit: radio
name: error_404Enable
id: error_404Enable
key: error_404Enable
help: 启动前请发布页面(自定义模板选择`404页面模版`,别名`404`)
value: false
options:
- label: 启用
value: true
- label: 禁用
value: false
- $formkit: text
name: subtitle
if: $get(error_404Enable).value
label: 标题
value: 请尝试站内搜索寻找文章
- $formkit: url
name: background
if: $get(error_404Enable).value
label: 背景
value: /themes/theme-hao/assets/images/404s.gif

View File

@ -245,7 +245,6 @@
isFriendLinksInFooter: [[${theme.config.footer.footer_group.enable_footer_group}]],
loadingBox: [[${theme.config.other.loadingBoxs.loadingBoxEnable}]],
loadProgressBar: [[${theme.config.other.loadingBoxs.loadProgressBar}]],
error404Enable: [[${theme.config.other.error_404.error_404Enable}]],
allPlaylist: [[${theme.config.tool.nav_music.all_playlist}]],
navMusicEnable:[[${theme.config.tool.nav_music.nav_musicEnable}]],
isMusic: [[${ htmlType == 'music'}]],

View File

@ -308,14 +308,12 @@
typeof preloader === 'object' && preloader.endLoading()
})
if(GLOBAL_CONFIG.error404Enable){
document.addEventListener('pjax:error', (e) => {
if (e.request.status === 404) {
pjax.loadUrl('/404')
if (e.request.status === 404 || e.request.status === 500) {
window.location.href = e.request.responseURL;
}
}
)
}
</script>

View File

@ -21,10 +21,6 @@ spec:
description: 音乐页面
screenshot:
file: music.html
- name: 404页面模版
description: 404 not found
screenshot:
file: 404.html
- name: 留言板页面模版
description: 留言板页面
screenshot: