From 36d4338368648874db2d00668a929a8d4097dd4f Mon Sep 17 00:00:00 2001 From: "1152958806@qq.com" <1152958806@qq.com> Date: Fri, 14 Jul 2023 01:59:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89404=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E7=94=A8=E4=BE=9D=E8=B5=96=E5=8F=91=E5=B8=83?= =?UTF-8?q?404=E9=A1=B5=E9=9D=A2=E4=B9=9F=E5=8F=AF=E4=BB=A5=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC404=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.yaml | 14 -------------- templates/{ => error}/404.html | 0 templates/modules/head.html | 1 - templates/modules/layouts/layout.html | 12 +++++------- theme.yaml | 4 ---- 5 files changed, 5 insertions(+), 26 deletions(-) rename templates/{ => error}/404.html (100%) diff --git a/settings.yaml b/settings.yaml index a40ccee6..15aa1202 100644 --- a/settings.yaml +++ b/settings.yaml @@ -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 diff --git a/templates/404.html b/templates/error/404.html similarity index 100% rename from templates/404.html rename to templates/error/404.html diff --git a/templates/modules/head.html b/templates/modules/head.html index 868b0a17..ef3c73a9 100644 --- a/templates/modules/head.html +++ b/templates/modules/head.html @@ -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'}]], diff --git a/templates/modules/layouts/layout.html b/templates/modules/layouts/layout.html index d03e6541..95d2af45 100644 --- a/templates/modules/layouts/layout.html +++ b/templates/modules/layouts/layout.html @@ -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') - } + document.addEventListener('pjax:error', (e) => { + if (e.request.status === 404 || e.request.status === 500) { + window.location.href = e.request.responseURL; } - ) - } + } + ) diff --git a/theme.yaml b/theme.yaml index 3f876b15..8bd939eb 100644 --- a/theme.yaml +++ b/theme.yaml @@ -21,10 +21,6 @@ spec: description: 音乐页面 screenshot: file: music.html - - name: 404页面模版 - description: 404 not found - screenshot: - file: 404.html - name: 留言板页面模版 description: 留言板页面 screenshot: