diff options
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_partials/posts/toc.html | 3 | ||||
| -rw-r--r-- | layouts/library/page.html | 7 | ||||
| -rw-r--r-- | layouts/page.html | 1 | ||||
| -rw-r--r-- | layouts/posts/page.html | 7 |
4 files changed, 8 insertions, 10 deletions
diff --git a/layouts/_partials/posts/toc.html b/layouts/_partials/posts/toc.html index ea87bb26..0bc96782 100644 --- a/layouts/_partials/posts/toc.html +++ b/layouts/_partials/posts/toc.html @@ -1,7 +1,8 @@ +{{ $top := cond (eq .Section "posts") "top-[19rem]" (cond (eq .Section "library") "top-[34rem]" "top-[17rem]") }} {{ if .Params.toc }} <div id="toc-container" class="absolute bottom-0 left-[calc(50%_+_var(--page-width)_/_2)] right-auto - h-full w-[calc(50%_-_var(--page-width)_/_2)] top-[19rem] hidden lg:block"> + h-full w-[calc(50%_-_var(--page-width)_/_2)] {{ $top }} hidden lg:block"> <div id="toc" class="sticky top-12 text-size-xs xl:text-size-sm 2xl:text-size-base w-full" >{{ .TableOfContents }}</div> diff --git a/layouts/library/page.html b/layouts/library/page.html index e8760b60..1e9753a5 100644 --- a/layouts/library/page.html +++ b/layouts/library/page.html @@ -27,8 +27,9 @@ </p> </header> - <div class="markdown-body"> - <div class="leading-loose">{{ .Content }}</div> + <div class="markdown-body leading-loose"> + {{ partial "posts/toc" . }} + <div>{{ .Content }}</div> {{ partial "posts/endnotes" . }} </div> @@ -43,7 +44,7 @@ {{ $books := where (where .Site.RegularPages "Section" "library") ".Params.author" "==" .Params.author }} {{ $thisBookID := .File.UniqueID }} - {{ if gt (count $books) 1 }} + {{ if gt (len $books) 1 }} <h2>我读过的{{ .Params.author }}的其它书籍</h2> <div class="grid grid-cols-4 md:grid-cols-6 items-center gap-4 my-4"> {{ range $books }} diff --git a/layouts/page.html b/layouts/page.html index e8e4221b..7b01bf7c 100644 --- a/layouts/page.html +++ b/layouts/page.html @@ -3,6 +3,7 @@ <article> <div id="post-content" class="post-content markdown-body leading-loose" style="view-transition-name: post-content-{{ .File.UniqueID }}"> + {{ partial "posts/toc" . }} {{ .Content }} </div> </article> diff --git a/layouts/posts/page.html b/layouts/posts/page.html index 545be626..ef891f7e 100644 --- a/layouts/posts/page.html +++ b/layouts/posts/page.html @@ -37,13 +37,8 @@ <!-- Post Content --> <div class="min-h-[60%] leading-loose mb-8 markdown-body" style="view-transition-name: post-content-{{ .File.UniqueID }}"> - <!-- TOC --> {{ partial "posts/toc" . }} - <!-- Content --> - <div id="post-content"> - {{ .Content }} - </div> - <!-- Endnotes --> + <div id="post-content">{{ .Content }}</div> {{ partial "posts/endnotes" . }} </div> |
