diff options
| author | Reorx <novoreorx@gmail.com> | 2022-04-22 00:28:30 +0800 |
|---|---|---|
| committer | Reorx <novoreorx@gmail.com> | 2022-04-22 00:28:30 +0800 |
| commit | 98b512fe646b5de3e3b4173f2f3c38e4f67e559b (patch) | |
| tree | ed4ca91f598a7e38e47738a3a37cf729266dff31 | |
| parent | 48cba7f5aedec28e24b427cd0a3b00ded924de63 (diff) | |
move tags to the top; use ¶ for anchor symbol
| -rw-r--r-- | assets/css/common/post-single.css | 43 | ||||
| -rw-r--r-- | layouts/_default/single.html | 21 | ||||
| -rw-r--r-- | layouts/partials/anchored_headings.html | 2 | ||||
| -rw-r--r-- | layouts/partials/post_meta.html | 17 |
4 files changed, 46 insertions, 37 deletions
diff --git a/assets/css/common/post-single.css b/assets/css/common/post-single.css index e5f85d5..61bdb66 100644 --- a/assets/css/common/post-single.css +++ b/assets/css/common/post-single.css @@ -18,11 +18,13 @@ .post-meta, .breadcrumbs { - color: var(--secondary); - font-size: 14px; + font-size: 15px; display: flex; flex-wrap: wrap; } +.post-meta * { + color: var(--secondary); +} .post-meta ul { margin: 0; @@ -39,6 +41,20 @@ margin-inline-end: .5em; } +.post-tags a:hover { + color: var(--primary); +} +.post-tags a:not(:last-of-type) { + margin-inline-end: .3em; +} +.post-tags a:not(:last-of-type):after { + content: ","; +} +.post-tags a:before { + content: "#"; + margin-inline-end: 2px; +} + .breadcrumbs a { font-size: 16px; } @@ -92,7 +108,7 @@ } .post-content a.anchor:hover { color: var(--primary); - box-shadow: 0 -2px 0 var(--secondary) inset; + box-shadow: 0 2px 0 var(--secondary); } .post-content a code { @@ -112,6 +128,9 @@ h5 .anchor, h6 .anchor { box-shadow: none; user-select: none; + font-size: .8em; + position: relative; + top: -2px; } h1:hover .anchor, @@ -374,13 +393,6 @@ h6:hover .anchor { margin-top: 56px; } -.post-tags li { - display: inline-block; - margin-inline-end: 3px; - margin-bottom: 5px; -} - -.post-tags a, .share-buttons, .paginav { border-radius: var(--radius); @@ -388,17 +400,6 @@ h6:hover .anchor { border: 1px solid var(--border); } -.post-tags a { - display: block; - padding-inline-start: 14px; - padding-inline-end: 14px; - color: var(--secondary); - font-size: 14px; - line-height: 34px; - background: var(--code-bg); -} - -.post-tags a:hover, .paginav a:hover { background: var(--border); } diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d313500..7f0d181 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -14,6 +14,20 @@ {{- end }} {{- if not (.Param "hideMeta") }} <div class="post-meta"> + {{- if not .Date.IsZero -}} + <span>{{ .Date | time.Format (default "January 2, 2006" site.Params.DateFormat) }}</span> + <span class="delimiter"> · </span> + {{- end }} + + {{- if .Params.tags }} + <span class="post-tags"> + {{- range ($.GetTerms "tags") -}} + <a href="{{ .Permalink }}">{{ .LinkTitle }}</a> + {{- end -}} + </span> + <span class="delimiter"> · </span> + {{- end }} + {{- partial "post_meta.html" . -}} {{- partial "translation_list.html" . -}} {{- partial "edit_post.html" . -}} @@ -36,13 +50,6 @@ {{- end }} <footer class="post-footer"> - {{- if .Params.tags }} - <ul class="post-tags"> - {{- range ($.GetTerms "tags") }} - <li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li> - {{- end }} - </ul> - {{- end }} {{- if (.Param "ShowPostNavLinks") }} {{- partial "post_nav_links.html" . }} {{- end }} diff --git a/layouts/partials/anchored_headings.html b/layouts/partials/anchored_headings.html index 377af89..29a09dd 100644 --- a/layouts/partials/anchored_headings.html +++ b/layouts/partials/anchored_headings.html @@ -1,2 +1,2 @@ {{- /* formats .Content headings by adding an anchor */ -}} -{{ . | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" "${1}<a hidden class=\"anchor\" aria-hidden=\"true\" href=\"#${2}\">#</a>${3}" | safeHTML }} +{{ . | replaceRE "(<h[1-6] id=\"([^\"]+)\".+)(</h[1-6]+>)" "${1}<a hidden class=\"anchor\" aria-hidden=\"true\" href=\"#${2}\">¶</a>${3}" | safeHTML }} diff --git a/layouts/partials/post_meta.html b/layouts/partials/post_meta.html index 38e957c..6ab5b80 100644 --- a/layouts/partials/post_meta.html +++ b/layouts/partials/post_meta.html @@ -1,15 +1,11 @@ {{- $scratch := newScratch }} -{{- if not .Date.IsZero -}} -{{- $scratch.Add "meta" (slice (printf "<span title='%s'>%s</span>" (.Date) (.Date | time.Format (default "January 2, 2006" site.Params.DateFormat)))) }} +{{- if (.Param "ShowWordCount") -}} +{{- $scratch.Add "meta" (slice (i18n "words" .WordCount | default (printf "%d words" .WordCount))) -}} {{- end }} {{- if (.Param "ShowReadingTime") -}} -{{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "<span>%d min</span>" .ReadingTime))) }} -{{- end }} - -{{- if (.Param "ShowWordCount") -}} -{{- $scratch.Add "meta" (slice (i18n "words" .WordCount | default (printf "<span>%d words</span>" .WordCount))) }} +{{- $scratch.Add "meta" (slice (i18n "read_time" .ReadingTime | default (printf "%d min" .ReadingTime))) -}} {{- end }} {{- if (.Param "ShowAuthor") -}} @@ -19,5 +15,10 @@ {{- end }} {{- with ($scratch.Get "meta") }} -{{- delimit . "<span class=\"delimiter\"> · </span>" -}} +{{ range $i, $e := . }} +{{ if $i }} +<span class="delimiter"> · </span> +{{ end }} +<span>{{ $e }}</span> +{{- end -}} {{- end -}} |
