搜索页
添加标签
在 ./layouts/_default/search.html 中末尾添加
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
{{- if not (.Param "hideTags") }}
{{- $taxonomies := .Site.Taxonomies.tags }}
{{- if gt (len $taxonomies) 0 }}
<h2 style="margin-top: 32px">{{- (.Param "tagsTitle") | default "tags" }}</h2>
<ul class="terms-tags">
{{- range $name, $value := $taxonomies }}
{{- $count := .Count }}
{{- with site.GetPage (printf "/tags/%s" $name) }}
<li>
<a href="{{ .Permalink }}">{{ .Name }} <sup><strong><sup>{{ $count }}</sup></strong></sup> </a>
</li>
{{- end }}
{{- end }}
</ul>
{{- end }}
{{- end }}
|
同时去 ./content/search.md 添加如下
1
2
|
hideTags: false
tagsTitle: Tags
|
Fuse.js
可以通过修改 config.yml 来配置搜索
1
2
3
4
5
6
7
8
|
fuseOpts: # 搜索配置
isCaseSensitive: false
shouldSort: true
location: 0
distance: 1000
threshold: 0.4
minMatchCharLength: 0
keys: [ "title", "permalink", "summary", "content" ]
|
文章概览
使用的应该是 summary 而不是 description