From 51cad0e4c709faa61c988bff48d5ffd721f1793d Mon Sep 17 00:00:00 2001 From: Airbo ZH Date: Sat, 11 Feb 2023 22:19:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=A0=B9=E6=8D=AEhtmlType=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2title?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/modules/layouts/layout.html | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/templates/modules/layouts/layout.html b/templates/modules/layouts/layout.html index a9374208..4de95de0 100644 --- a/templates/modules/layouts/layout.html +++ b/templates/modules/layouts/layout.html @@ -28,6 +28,37 @@ }, }; + + // 根据htmlType设置页面title + let setTitle = ()=>{ + let title = '' + + switch([[${htmlType}]]){ + case 'post': + if(GLOBAL_CONFIG.postTitle != '') + title = GLOBAL_CONFIG.postTitle + break; + case 'archive': + title = '归档' + break; + case 'category': + title = '分类' + break; + case 'links': + title = '友链' + break; + case 'tag': + title = '标签' + break; + } + if(title != '') + document.title = title + ' - ' + [[${site.title}]] + } + + (() => { + setTitle() + })() +