在 Hexo 主题 shoka (はい、就是我使用的主题)中,子标题(subtitle,见 _config.yml )通常会在两边分别加上一个等号 =

带有等号的子标题

琉璃大人用等号缀在子标题旁边,对于子标题写汉字的用户非常美观。不过对于署版权或其他信息的使用者稍有突兀。

解决方法是,修改 themes/shoka/layout/_partials/layout.njk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
{% import '_macro/sidebar.njk' as sidebar with context %}
{% import '_macro/breadcrumb.njk' as breadcrumb with context %}
{% import '_macro/widgets.njk' as widgets with context %}

<!DOCTYPE html>
<html lang="{{ page.language if page.language else config.language }}">
<head>
{{ partial('_partials/head/head.njk', {}, {cache: true}) }}
{{ partial('_partials/head/head_unique.njk') }}
<title>{% block title %}{% endblock %}{{ alternate + " = " if alternate }}{{ title }}{{ " = "+subtitle if subtitle }}</title>
</head>
<body itemscope itemtype="http://schema.org/WebPage">
<div id="loading">
<div class="cat">
<div class="body"></div>
<div class="head">
<div class="face"></div>
</div>
<div class="foot">
<div class="tummy-end"></div>
<div class="bottom"></div>
<div class="legs left"></div>
<div class="legs right"></div>
</div>
<div class="paw">
<div class="hands left"></div>
<div class="hands right"></div>
</div>
</div>
</div>
<div id="container">
<header id="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="inner">
<div id="brand">
<div class="pjax">
{% block header %}
<a href="{{ config.root }}" class="logo" rel="start">
{%- if alternate %}<p class="artboard">{{ alternate }}</p>{%- endif %}
<h1 itemprop="name headline" class="title">{{ title }}</h1>
</a>
{%- if subtitle %}
<p class="meta" itemprop="description">{{ subtitle }}</p>
{%- endif %}
{% endblock %}
</div>
</div>
{{ partial('_partials/header.njk', {}, {cache: true}) }}
</div>
<div id="imgs" class="pjax">
{%- set covers = _cover(page, 6) %}
{%- if covers.length == 6 %}
<ul>
{%- for image in covers %}
<li class="item" data-background-image="{{ image }}"></li>
{%- endfor %}
</ul>
{%- else %}
<img src="{{ covers }}">
{%- endif %}
</div>
</header>
<div id="waves">
<svg class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto">
<defs>
<path id="gentle-wave" d="M-160 44c30 0 58-18 88-18s 58 18 88 18 58-18 88-18 58 18 88 18 v44h-352z" />
</defs>
<g class="parallax">
<use xlink:href="#gentle-wave" x="48" y="0" />
<use xlink:href="#gentle-wave" x="48" y="3" />
<use xlink:href="#gentle-wave" x="48" y="5" />
<use xlink:href="#gentle-wave" x="48" y="7" />
</g>
</svg>
</div>
<main>
<div class="inner">
<div id="main" class="pjax">
{% block content %}{% endblock %}
</div>
<div id="sidebar">
{% block sidebar %}{{ sidebar.render() }}{% endblock %}
</div>
<div class="dimmer"></div>
</div>
</main>
<footer id="footer">
<div class="inner">
<div class="widgets">
{{ widgets.render() }}
</div>
{{ partial('_partials/footer.njk', {}, {cache: true}) }}
</div>
</footer>
</div>

{%- set ccIcon = '<i class="ic i-creative-commons"></i>' %}
{%- set ccText = theme.creative_commons.license | upper %}
<script data-config type="text/javascript">
var LOCAL = {
path: '{{ _permapath(page.path) }}',
favicon: {
show: "{{ __('favicon.show') }}",
hide: "{{ __('favicon.hide') }}"
},
search : {
placeholder: "{{ __('search.placeholder') }}",
empty: "{{ __('search.empty') }}",
stats: "{{ __('search.stats') }}"
},
{%- if theme.widgets.recent_comments or page.comment !== false %}
valine: {{ page.valine|safedump if page.valine else "true" }},{%- endif %}
{%- if page.chart %}chart: true,{%- endif %}
{%- if page.math %}copy_tex: true,
katex: true,{%- endif %}
{%- if page.mermaid %}mermaid: true,{%- endif %}
{%- if page.audio %}audio: {{ page.audio|safedump }},{%- endif %}
{%- if page.audio === false %}audio: {},{%- endif %}
{%- if page.fancybox !== false %}fancybox: true,{%- endif %}
{%- if page.copyright !== false %}
{%- if page.copyright === true %}nocopy: true,
copyright: '{{ __("tips.nocopy")}}',{%- else %}
copyright: '{{ __("tips.copyright", ccIcon + ccText) }}',
{%- endif %}{%- endif %}
{%- if page.quiz %}quiz: {
choice: "{{ __('quiz.choice') }}",
multiple: "{{ __('quiz.multiple') }}",
true_false: "{{ __('quiz.true_false') }}",
essay: "{{ __('quiz.essay') }}",
gap_fill: "{{ __('quiz.gap_fill') }}",
mistake: "{{ __('quiz.mistake') }}"
},{%- endif %}
ignores : [
function(uri) {
return uri.includes('#');
},
function(uri) {
return new RegExp(LOCAL.path+"$").test(uri);
}{%- if theme.quicklink.ignores %},
{{ theme.quicklink.ignores|safedump }}
{%- endif %}
]
};
</script>

<script src="https://cdn.polyfill.io/v2/polyfill.js"></script>

{{ _vendor_js() }}

{{ _js('app.js')}}

{{ partial('_partials/third-party/baidu-analytics.njk', {}, {cache: true}) }}

</body>
</html>

其中一行:

1
<p class="meta" itemprop="description">= {{ subtitle }} =</p>

删去 ==

1
<p class="meta" itemprop="description">{{ subtitle }}</p>

保存文件后重新部署 Hexo,等待即可发现等号已被删去:

不带有等号的子标题

如果你想自定义为其他字符,也可根据语法修改。