head头部标题修改

This commit is contained in:
1152958806@qq.com 2023-08-23 00:51:45 +08:00
parent 618d564834
commit 19d7d28b4c
25 changed files with 78 additions and 144 deletions

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'about')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'about',title = ${'关于' + ' | ' + site.title})}">
<th:block th:fragment="content">
@ -8,7 +8,7 @@
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = '关于')}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page',title = ${singlePage.spec.title + ' | ' + site.title})}">
<th:block th:fragment="content">
@ -8,7 +8,7 @@
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${singlePage.spec.title})}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">
@ -26,7 +26,7 @@
<img class="card_cover"
th:src="${isLazyload ? loadingImg : #annotations.get(group, 'cover')}"
th:data-lazy-src="${ isLazyload ? #annotations.get(group, 'cover') : ''}"
>
>
<div class="card__content">
<p class="card__category" th:text="${group.spec.displayName}"></p>
<h3 class="card__heading" th:text="${#annotations.get(group, 'description')}"></h3>

View File

@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'archive')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'archive',title = ${'文章' + ' | ' + site.title})}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = '文章')}"></nav>
</header>
<main class="layout" id="content-inner">
<!-- archive -->

View File

@ -168,17 +168,6 @@ function getContrastYIQ(hexcolor) {
}
}
//导航栏文章
function navTitle() {
var titlevalue = document.title;
var postName = document.getElementsByClassName("post-title")[0];
if(postName==null || postName==''){
document.getElementById("page-name-text").innerHTML = titlevalue;
}else{
document.getElementById("page-name-text").innerHTML = postName?.innerText;
}
}
window.onload = function () {
var copybtnlist = document.getElementsByClassName("copybtn")
for (var i = 0; i < copybtnlist.length; i++) {
@ -662,7 +651,6 @@ function listenToPageInputPress() {
function initBlog() {
// 图片主色
GLOBAL_CONFIG.source.post.dynamicBackground && coverColor(),
navTitle(),
percent(),
heo.topCategoriesBarScroll(),
heo.initIndexEssay(),

View File

@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'bangumis')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'bangumis',title = ${'追番' + ' | ' + site.title})}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = '追番')}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">

View File

@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'category')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'category',title = ${'分类' + ' | ' + site.title})}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = '分类')}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">

View File

@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'category')}" xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'category',title = ${'分类' + ': ' + category.spec.displayName + ' | ' + site.title})}" >
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${'分类' + ': ' + category.spec.displayName})}"></nav>
</header>
<main class="layout" id="content-inner">
<div id="category">

View File

@ -1,16 +1,14 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page',title = ${singlePage.spec.title + ' | ' + site.title})}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${singlePage.spec.title})}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page',title = ${singlePage.spec.title + ' | ' + site.title})}">
<th:block th:fragment="content">
@ -8,7 +8,7 @@
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${singlePage.spec.title})}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">
@ -49,7 +49,7 @@
<a class="bber-reply"
th:onclick="rightMenuCommentText([['&quot;'+${equipment.name}+' '+${equipment.model}+' '+${equipment.description}+'&quot;']]);"
data-pjax-state="">
<i class="haofont hao-icon-message" style="font-size: 18px;"></i>
<i class="fa-solid fa-message" style="font-size: 18px;"></i>
</a>
</div>
</div>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'fcircle')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'fcircle',title = ${'友链鱼塘' + ' | ' + site.title} )}">
<th:block th:fragment="content">
@ -8,7 +8,7 @@
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = '友链鱼塘')}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">

View File

@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'index')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'index', title = ${site.title})}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<!-- 头部导航栏 -->
<header th:class="${theme.config.top.above.enable_above ? 'full_page' : 'not-top-img'}" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${siteSubtitle})}"></nav>
<!-- 问候语 -->
<th:block th:replace="~{modules/header/greeting :: greeting}"></th:block>
<!-- 第一屏 -->

View File

@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'links')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'links',title = ${'友链' + ' | ' + site.title})}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = '友链')}"></nav>
<link rel="stylesheet" type="text/css" th:href="${assets_link + '/libs/fcircle/heo-fcircle3.css' + theme_version}">
</header>

View File

@ -5,7 +5,7 @@
th:if="${theme.config.other.diytitle.diytitleEnable}">
let leaveTitle = '[[${theme.config.other.diytitle.leaveTitle}]]';
let backTitle = '[[${theme.config.other.diytitle.backTitle}]]';
let OriginTitile = document.title
let OriginTitile = "[(${title})]"
let titleTime
document.addEventListener('visibilitychange', function () {
if (document.hidden) {

View File

@ -1,11 +1,10 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!-- 公共的 head 部分,可以定义部分 links,scripts,styles -->
<head th:fragment="head(htmlType)">
<th:block th:fragment="head(htmlType)">
<meta charset="UTF-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width,initial-scale=1" name="viewport">
<title th:text="${site.title}"></title>
<meta content="telephone=no" name="format-detection">
<meta content="var(--heo-card-bg)" name="theme-color">
<link rel="shortcut icon"
@ -271,61 +270,6 @@
};
// 根据htmlType设置页面title
setTitle = () => {
let title = ''
switch ([[${ htmlType }]]) {
case 'post':
if (GLOBAL_CONFIG.postTitle != '')
title = GLOBAL_CONFIG.postTitle
break;
case 'page':
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;
case 'moments':
title = '瞬间'
break;
case 'fcircle':
title = '友链鱼塘'
break;
case 'about':
title = '关于'
break;
case '404':
title = '页面没有找到'
break;
case 'music':
title = '音乐馆'
break;
case 'photos':
title = '图库'
break;
case 'bangumis':
title = '追番'
break;
}
if (title != '')
document.title = title + ' - ' + [[${ site.title }]]
}
(() => {
setTitle()
})()
</script>
@ -342,6 +286,6 @@
</head>
</th:block>
</html>

View File

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en" th:fragment="layout(content, htmlType)" xmlns:th="http://www.thymeleaf.org"
<html lang="en" th:fragment="layout(content, htmlType, title)" xmlns:th="http://www.thymeleaf.org"
th:with="assets_link=${theme.config.other.staticResource.use == 'onmicrosoft' ? 'https://npm.onmicrosoft.cn/hao-theme-static@' + theme.spec.version +'/templates/assets' :
theme.config.other.staticResource.use == 'cbd' ? 'https://cdn.cbd.int/hao-theme-static@' + theme.spec.version +'/templates/assets' :
theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')},
@ -9,8 +9,9 @@
<!-- head 中自定义的 -->
<head th:replace="~{modules/head :: head(htmlType = ${htmlType})}">
<title th:text="${site.title}"></title>
<head>
<th:block th:replace="~{modules/head :: head(htmlType = ${htmlType})}"/>
<title th:text="${title}"></title>
</head>
<body>
@ -110,13 +111,13 @@
<!-- 51统计 -->
<th:block th:replace="~{modules/common/51-la :: 51-la}"></th:block>
<!-- 动态标题 -->
<script th:replace="~{modules/common/diytitle :: diytitle}"></script>
<!--官方评论插件js-->
<script th:if="${pluginFinder.available('PluginCommentWidget')}" src="/plugins/PluginCommentWidget/assets/static/comment-widget.iife.js"></script>
<div id="js-pjax"></div>
<div class="js-pjax">
<!-- 动态标题 -->
<script th:replace="~{modules/common/diytitle :: diytitle}"></script>
</div>
<script th:if="${theme.config.envelope_comment.enable_danmu}" th:src="${assets_link + '/libs/twikoo/easy-Danmaku.min.js' + theme_version}" id="Danmaku"></script>

View File

@ -5,10 +5,11 @@
<!-- 导航栏左侧 -->
<div th:replace="~{modules/widgets/nav-left :: nav-left}"></div>
<div id="page-name-mask">
<div id="page-name"><a id="page-name-text" onclick="btf.scrollToDest(0,500)"
th:text="${#strings.isEmpty(title) ? site.title : title}"></a></div>
<div id="page-name" >
<a id="page-name-text" onclick="btf.scrollToDest(0,500)"
th:text="${#strings.isEmpty(title) ? site.title : title}"></a>
</div>
</div>
<!-- 导航栏中间 -->

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'moments')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'moments',title = ${title + ' | ' + site.title})}">
<th:block th:fragment="content">
@ -8,7 +8,7 @@
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${title})}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">
@ -53,7 +53,7 @@
</div>
<a class="bber-reply"
th:onclick="rightMenuCommentText([[${content.html}]]);"
data-pjax-state=""> <i class="haofont hao-icon-message"></i>
data-pjax-state=""> <i class="fa-solid fa-message"></i>
</a>
</div>
</li>

View File

@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'music')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'music',title = '音乐馆' + ' | ' + site.title)}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = '音乐馆')}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page')}" xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page',title = ${singlePage.spec.title + ' | ' + site.title})}">
<th:block th:fragment="content">
@ -7,7 +8,7 @@
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${singlePage.spec.title})}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">

View File

@ -1,11 +1,11 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page',title = ${singlePage.spec.title + ' | ' + site.title})}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${singlePage.spec.title})}"></nav>
<link rel="stylesheet" type="text/css" th:href="${assets_link + '/libs/fcircle/heo-fcircle3.css' + theme_version}">
</header>

View File

@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'photos')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content},htmlType = 'photos',title = ${title + ' | ' + site.title})}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${title})}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'post')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'post',title = ${post.spec.title + ' | ' + site.title})}">
<th:block th:fragment="content">
<div class="post" id="body-wrap">

View File

@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'tag')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'tag',title = ${'标签' + ': ' + tag.spec.displayName + ' | ' + site.title})}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${'标签'+ ': ' + tag.spec.displayName})}"></nav>
</header>
<main class="layout" id="content-inner">
<div id="tag">

View File

@ -1,12 +1,12 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'tag')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content},htmlType = 'tag',title = ${'标签' + ' | ' + site.title})}">
<th:block th:fragment="content">
<div class="page" id="body-wrap">
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = '标签')}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page"><h1 class="page-title" style="display: inline;">标签</h1>
@ -16,7 +16,7 @@
th:href="@{${tagItem.status.permalink}}"
th:id="${tagItem.spec.displayName}" th:style="'font-size: 1em; color:' + ${tagItem.spec.color} ">
<span class="tags-punctuation">[[${tagItem.spec.displayName}]]</span>
<span class="tagsPageCount">[[${tagItem.status.visiblePostCount}]]</span>
</a>

View File

@ -1,6 +1,6 @@
<!DOCTYPE html>
<html lang="en" th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page')}"
xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{modules/layouts/layout :: layout(content = ~{::content}, htmlType = 'page',title = ${singlePage.spec.title + ' | ' + site.title})}">
<th:block th:fragment="content">
@ -8,7 +8,7 @@
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="~{modules/nav :: nav(title = null)}"></nav>
<nav th:replace="~{modules/nav :: nav(title = ${singlePage.spec.title})}"></nav>
</header>
<main class="layout hide-aside" id="content-inner">
<div id="page">