diff options
| author | Eltrac <hi@guhub.cn> | 2025-05-23 09:16:32 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-05-23 09:16:32 +0800 |
| commit | a3b7096550dd7d7f143bd259383f7f3aa4f32a20 (patch) | |
| tree | cb399f05cb33b9bae49eeb1f42751901af54ca66 | |
| parent | ade6601ce692307ddc1798417e8cb1647643c898 (diff) | |
feat: post endnotes
| -rw-r--r-- | assets/css/components/_post.scss | 21 | ||||
| -rw-r--r-- | layouts/posts/single.html | 15 |
2 files changed, 32 insertions, 4 deletions
diff --git a/assets/css/components/_post.scss b/assets/css/components/_post.scss index 05e29e08..4ff79bb6 100644 --- a/assets/css/components/_post.scss +++ b/assets/css/components/_post.scss @@ -120,3 +120,24 @@ } } } + +/* endnotes */ + +#post-endnotes { + color: var(--secondary-text-color); + font-size: 1rem; + h3 { + font-size: 1rem; + width: fit-content; + margin: 0; + } + ul { + li { + list-style-type: '→'; + padding-left: 1rem; + &::marker { + color: var(--secondary-text-color); + } + } + } +} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 00517df4..53182ef7 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -35,13 +35,20 @@ </header> <!-- Post Content --> - <div id="post-content" class="post-content markdown-body" + <div class="post-content markdown-body" style="view-transition-name: post-content-{{ .File.UniqueID }}"> {{ if .Params.toc }}{{ partial "components/toc" . }}{{ end }} {{ .Site.Params.postHeaderContent | safeHTML }} - {{ .Content }} - {{ if eq .Site.Language.Lang "zh" }} - <p style="font-size: 0.9rem">如果你觉得文章对你有帮助,可以考虑<a href="/sponsor">赞助作者</a></p> + <div id="post-content">{{ .Content }}</div> + {{ if .Params.endnotes }} + <hr> + <div id="post-endnotes"> + <ul> + {{ range .Params.endnotes }} + <li>{{ . | markdownify }}</li> + {{ end }} + </ul> + </div> {{ end }} </div> |
