feat: new mobile toc

This commit is contained in:
Dillon
2019-08-20 03:01:15 +08:00
parent f4cda2e602
commit 3d8efd6319
5 changed files with 109 additions and 24 deletions

View File

@@ -39,6 +39,10 @@
</div>
</div>
{{ with .Params.featured_image }}
<img src=/images/loading.svg data-sizes=auto data-src={{ . }} alt="featured image" class="featured_image lazyload">
{{ end }}
{{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
<div class="post-toc" id="post-toc">
<h2 class="post-toc-title">{{ T "toc" }}</h2>
@@ -47,12 +51,16 @@
{{ .TableOfContents }}
</div>
</div>
<div class="post-toc-mobile" id="post-toc-mobile">
<details>
<summary class="post-toc-title">{{ T "toc" }}<i class="details icon fas fa-angle-down"></i></summary>
<div class="post-toc-content">
{{ .TableOfContents }}
</div>
</details>
</div>
{{- end }}
{{ with .Params.featured_image }}
<img src=/images/loading.svg data-sizes=auto data-src={{ . }} alt="featured image" class="featured_image lazyload">
{{ end }}
<div class="post-content">
{{ $content := .Content }}
{{ $REin := `<img src="([^"]+)" alt="([^"]+)?" />` }}