feat(search): add local search (#231)

* feat(search): add local search

* docs: add docs for search
This commit is contained in:
Dillon
2020-04-15 15:46:50 +08:00
committed by GitHub
parent b6ce753ae7
commit 90184ca3e7
92 changed files with 4843 additions and 1214 deletions

View File

@@ -2,6 +2,16 @@
{{- define "content" -}}
{{- $scratch := .Scratch.Get "scratch" -}}
{{- /* Auto TOC */ -}}
{{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
<div class="toc" id="toc-auto">
<h2 class="toc-title">{{ T "contents" }}</h2>
{{- $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }}
<div class="toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false)) }} always-active{{ end }}" id="toc-content-auto"></div>
</div>
{{- end -}}
<article class="page single">
{{- /* Title */ -}}
<h1 class="single-title animated flipInX">{{ .Title }}</h1>
@@ -52,13 +62,8 @@
</div>
{{- end -}}
{{- /* TOC */ -}}
{{- /* Static TOC */ -}}
{{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
<div class="toc" id="toc-auto">
<h2 class="toc-title">{{ T "contents" }}</h2>
{{- $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }}
<div class="toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false)) }} always-active{{ end }}" id="toc-content-auto"></div>
</div>
<div class="toc" id="toc-static">
<details>
<summary>
@@ -79,7 +84,7 @@
{{- /* Content */ -}}
<div class="content" id="content">
{{- partial "single/content.html" .Content -}}
{{- partial "function/content.html" .Content | safeHTML -}}
</div>
{{- /* Footer */ -}}