主题没有将站长名称和站点名称区分开,因此自己动手,丰衣足食!
- 修改
config.yaml
文件
添加了name
字段
1
2
3
|
params:
sidebar:
name: 站长名称
|
- 修改
.\themes\hugo-theme-stack\layouts\partials\sidebar\left.html
文件
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
|
<aside
class="sidebar left-sidebar sticky {{ if .Site.Params.sidebar.compact }}compact{{ end }}"
>
<button
class="hamburger hamburger--spin"
type="button"
id="toggle-menu"
aria-label="{{ T `toggleMenu` }}"
>
<span class="hamburger-box">
<span class="hamburger-inner"></span>
</span>
</button>
<header>
{{ with .Site.Params.sidebar.avatar }} {{ if (default true .enabled) }}
<figure class="site-avatar">
<a href="{{ .Site.BaseURL | relLangURL }}">
{{ if not .local }}
<img
src="{{ .src }}"
width="300"
height="300"
class="site-logo"
loading="lazy"
alt="Avatar"
/>
{{ else }} {{ $avatar := resources.Get (.src) }} {{ if $avatar }} {{
$avatarResized := $avatar.Resize "300x" }}
<img
src="{{ $avatarResized.RelPermalink }}"
width="{{ $avatarResized.Width }}"
height="{{ $avatarResized.Height }}"
class="site-logo"
loading="lazy"
alt="Avatar"
/>
{{ else }} {{ errorf "Failed loading avatar from %q" . }} {{ end }} {{
end }}
</a>
{{ with $.Site.Params.sidebar.emoji }}
<span class="emoji">{{ . }}</span>
{{ end }}
</figure>
{{ end }} {{ end }}
<div class="site-meta">
<h1 class="site-name">
<a href="{{ .Site.BaseURL | relLangURL }}"
>{{ .Site.Params.sidebar.name }}</a
>
</h1>
<h2 class="site-description">{{ .Site.Params.sidebar.subtitle }}</h2>
</div>
</header>
{{- with .Site.Menus.social -}}
<ol class="social-menu">
{{ range . }}
<li>
<a
href="{{ .URL }}"
{{
if
eq
(default
true
.Params.newTab)
true
}}target="_blank"
{{
end
}}
{{
with
.Name
}}title="{{ . }}"
{{
end
}}
>
{{ $icon := default "link" .Params.Icon }} {{ with $icon }} {{ partial
"helper/icon" . }} {{ end }}
</a>
</li>
{{ end }}
</ol>
{{- end -}}
<ol class="menu" id="main-menu">
{{ $currentPage := . }} {{ range .Site.Menus.main }} {{ $active := or (eq
$currentPage.Title .Name) (or ($currentPage.HasMenuCurrent "main" .)
($currentPage.IsMenuCurrent "main" .)) }}
<li {{ if $active }} class="current" {{ end }}>
<a
href="{{ .URL | relLangURL }}"
{{
if
eq
.Params.newTab
true
}}target="_blank"
{{
end
}}
>
{{ $icon := default .Pre .Params.Icon }} {{ if .Pre }} {{ warnf "Menu
item [%s] is using [pre] field to set icon, please use [params.icon]
instead.\nMore information:
https://docs.stack.jimmycai.com/configuration/custom-menu.html" .URL }}
{{ end }} {{ with $icon }} {{ partial "helper/icon" . }} {{ end }}
<span>{{- .Name -}}</span>
</a>
</li>
{{ end }}
<div class="menu-bottom-section">
{{- $currentLanguageCode := .Language.Lang -}} {{ with
.Site.Home.AllTranslations }}
<li id="i18n-switch">
{{ partial "helper/icon" "language" }}
<select
name="language"
onchange="window.location.href = this.selectedOptions[0].value"
>
{{ range . }}
<option
value="{{ .Permalink }}"
{{
if
eq
.Language.Lang
$currentLanguageCode
}}selected{{
end
}}
>
{{ .Language.LanguageName }}
</option>
{{ end }}
</select>
</li>
{{ end }} {{ if (default false .Site.Params.colorScheme.toggle) }}
<li id="dark-mode-toggle">
{{ partial "helper/icon" "toggle-left" }} {{ partial "helper/icon"
"toggle-right" }}
<span>{{ T "darkMode" }}</span>
</li>
{{ end }}
</div>
</ol>
</aside>
|
- 修改
.\themes\hugo-theme-stack\layouts\index.html
站点名称添加了关于
页面的链接,可自行更改
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
{{ define "main" }} {{ $pages := where .Site.RegularPages "Type" "in"
.Site.Params.mainSections }} {{ $notHidden := where .Site.RegularPages
"Params.hidden" "!=" true }} {{ $filtered := ($pages | intersect $notHidden) }}
{{ $pag := .Paginate ($filtered) }}
<div class="site-meta">
<h1 class="site-title" align="center">
<a href="{{ .Site.BaseURL | relLangURL }}about/">{{ .Site.Title }}</a>
</h1>
</div>
<section class="article-list">
{{ range $index, $element := $pag.Pages }} {{ partial "article-list/default" .
}} {{ end }}
</section>
{{- partial "pagination.html" . -}} {{- partial "footer/footer" . -}} {{ end }}
{{ define "right-sidebar" }} {{ partial "sidebar/right.html" (dict "Context" .
"Scope" "homepage") }} {{ end }}
|