diff options
author | He Yeshuang <yeshuanghe@gmail.com> | 2020-06-20 16:49:36 +0300 |
---|---|---|
committer | He Yeshuang <yeshuanghe@gmail.com> | 2020-06-20 16:49:36 +0300 |
commit | 7394031c54d66e6285b4dcc041651a9125a0ff50 (patch) | |
tree | a0b2acbe50930716a0b4e2f686c328bc68687499 /layouts | |
parent | 3df24a82173e10f6b9b1a59f7e588a3e38fb3c97 (diff) |
add 'table of contents' feature
Diffstat (limited to 'layouts')
-rwxr-xr-x | layouts/_default/baseof.html | 2 | ||||
-rw-r--r-- | layouts/partials/page-header.html | 1 | ||||
-rw-r--r-- | layouts/partials/toc.html | 10 |
3 files changed, 12 insertions, 1 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a5c058c..f00228e 100755 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -115,7 +115,7 @@ <div class="p-6 sm:p-10 md:p-16 flex flex-wrap"> <header class="w-full md:w-2/5 xl:w-1/2 md:pr-12 lg:pr-20 xl:pr-24 order-1 md:order-1 max-w-2xl"> <div - class="z-50 bg-gray-100 lg:min-w-0.7 max-w-xl md:float-right md:text-right leading-loose tracking-tight md:sticky md:top-0 pt-2"> + class="z-50 bg-gray-100 bg-opacity-75 bg-opacity-custom lg:min-w-0.7 max-w-xl md:float-right md:text-right leading-loose tracking-tight md:sticky md:top-0 pt-2"> {{ block "header" . }}{{ partial "site-header.html" .}}{{ end }} </div> </header> diff --git a/layouts/partials/page-header.html b/layouts/partials/page-header.html index e66b019..6aeb563 100644 --- a/layouts/partials/page-header.html +++ b/layouts/partials/page-header.html @@ -16,4 +16,5 @@ {{- .Date.Format "2006-1-2 15:04" -}} </time> </div> +{{ partial "toc.html" . }} <hr />
\ No newline at end of file diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html new file mode 100644 index 0000000..1c6b5e0 --- /dev/null +++ b/layouts/partials/toc.html @@ -0,0 +1,10 @@ +{{ if (.Params.toc) }} +<details class="toc" open> +<summary> + <hr /> +</summary> +<div class="inline toc-content"> + {{.TableOfContents}} +</div> +</details> +{{ end }}
\ No newline at end of file |