diff options
| author | Arne Rief <riearn@proton.me> | 2025-09-15 17:11:49 +0200 |
|---|---|---|
| committer | Arne Rief <riearn@proton.me> | 2025-09-15 17:11:49 +0200 |
| commit | bea135e9b4945cf58a066e88de7bcc24605761de (patch) | |
| tree | 84da5c1b2d5e73aa17ad338322c9a71eb51979bc /layouts | |
| parent | afc1f095745a548ff400f187d53bc1570f02bcf2 (diff) | |
Scroll to top, conditional date on posts
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_default/single.html | 6 | ||||
| -rw-r--r-- | layouts/partials/single/next-prev.html | 13 |
2 files changed, 16 insertions, 3 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index dba5a10..e1728d3 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -4,9 +4,11 @@ <h1 class="post__headline"> {{ .Title }} </h1> - <time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" class="post__publish-date"> - {{ .Date | time.Format ":date_medium" }} + {{- with .Date }} + <time datetime="{{ .Format "2006-01-02T15:04:05Z07:00" }}" class="post__publish-date"> + {{ . | time.Format ":date_medium" }} </time> + {{- end }} </header> <div class="post__content"> diff --git a/layouts/partials/single/next-prev.html b/layouts/partials/single/next-prev.html index 73d48cf..4d6e962 100644 --- a/layouts/partials/single/next-prev.html +++ b/layouts/partials/single/next-prev.html @@ -1,4 +1,4 @@ -{{- /* Navigation for Next and Previous Post */ -}} +{{- /* Navigation for next & previous post and back to top */ -}} {{- if ne .Params.excludeFromLists true }} <nav class="post__navigation" aria-label="{{ lang.Translate "post.navigation" | default "Post navigation" }}"> <ul class="post__navigation-list"> @@ -29,4 +29,15 @@ {{- end }} </ul> </nav> + +<a + href="#" + class="post__scroll-top" + aria-label="{{ lang.Translate "posts.top" | default "Back to top" }}" + title="{{ lang.Translate "posts.top" | default "Back to top" }}" +> + <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"> + <path d="M17 15L12 10L7 15" stroke="#000000" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/> + </svg> +</a> {{- end }} |
