diff options
| author | Arne Rief <riearn@proton.me> | 2025-09-04 20:05:27 +0200 |
|---|---|---|
| committer | Arne Rief <riearn@proton.me> | 2025-09-04 20:05:27 +0200 |
| commit | 26df3baeb1afcb4c41ec99f940b237b9589caa42 (patch) | |
| tree | ee970fe0810d56a4b83174d282127593ba418547 /layouts | |
| parent | 2204aa9db535af9b0c38487f74a56bd0ac9f07e2 (diff) | |
Ready for deployment
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_default/all-posts.html | 36 | ||||
| -rw-r--r-- | layouts/_default/list.html | 4 | ||||
| -rw-r--r-- | layouts/_default/single.html | 4 | ||||
| -rw-r--r-- | layouts/index.html | 2 | ||||
| -rw-r--r-- | layouts/partials/list/pagination.html | 4 | ||||
| -rw-r--r-- | layouts/partials/list/post-card.html | 16 | ||||
| -rw-r--r-- | layouts/partials/list/recent-posts.html | 19 | ||||
| -rw-r--r-- | layouts/partials/navmenu.html | 3 | ||||
| -rw-r--r-- | layouts/partials/select-theme.html | 12 | ||||
| -rw-r--r-- | layouts/partials/single/next-prev.html | 2 | ||||
| -rw-r--r-- | layouts/tags/term.html | 6 |
11 files changed, 74 insertions, 34 deletions
diff --git a/layouts/_default/all-posts.html b/layouts/_default/all-posts.html new file mode 100644 index 0000000..319a8d5 --- /dev/null +++ b/layouts/_default/all-posts.html @@ -0,0 +1,36 @@ +{{ define "main" }} +<section class="search-page"> + <header class="all-posts__header"> + <h1 class="all-posts__heading"> + {{ .Title }} + </h1> + {{- with .Content }} + <div class="all-posts__description"> + {{ . }} + </div> + {{- else }} + {{- $description := or .Description (lang.Translate "posts.all_description" | default "All posts on this website, from newest to oldest.") }} + <p class="all-posts__description"> + {{ $description }} + </p> + {{- end }} + </header> + + {{ $allPosts := where site.RegularPages "Params.excludeFromLists" "!=" true }} + {{- if $allPosts }} + <div class="all-posts__content"> + <ul class="all-posts__list" role="list"> + {{- range $allPosts.ByDate.Reverse }} + <li class="all-posts__list-item"> + {{ partial "list/post-card.html" . }} + </li> + {{- end }} + </ul> + </div> + {{ else }} + <p class="all-posts__empty-message"> + {{ lang.Translate "posts.empty" | default "This site does not have any posts yet." }} + </p> + {{- end }} +</section> +{{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index d3d2d99..a8cb92a 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -17,8 +17,8 @@ </header> <section class="list-page__content" aria-label="{{ lang.Translate "posts.name" | default "Posts" }}"> - {{- /* 20 posts per site */ -}} - {{- $paginator := .Paginate .Pages 20 }} + {{- /* 15 posts per site */ -}} + {{- $paginator := .Paginate .Pages 15 }} {{- with $paginator.Pages }} <ul class="list-page__posts-list"> {{- range . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 24bc5c9..dba5a10 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,7 +1,9 @@ {{- define "main" }} <article class="post"> <header class="post__header"> - <h1 class="post__headline">{{ .Title }}</h1> + <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" }} </time> diff --git a/layouts/index.html b/layouts/index.html index 127af83..b23b087 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -13,7 +13,7 @@ </header> {{- partial "list/recent-posts.html" (dict - "count" 10 + "count" 5 "title" (lang.Translate "posts.recent" | default "Recent Articles") "show_view_all" true ) diff --git a/layouts/partials/list/pagination.html b/layouts/partials/list/pagination.html index 47d90ff..d1170e1 100644 --- a/layouts/partials/list/pagination.html +++ b/layouts/partials/list/pagination.html @@ -7,7 +7,7 @@ rel="prev" aria-label="{{ lang.Translate "pagination.previous_page" | default "Previous page" }}" > - ← {{ lang.Translate "common.previous" | default "Previous" }} + ← {{ lang.Translate "common.previous" | default "Previous" }} </a> {{- end }} @@ -21,7 +21,7 @@ rel="next" aria-label="{{ lang.Translate "pagination.next_page" | default "Next page" }}" > - {{ lang.Translate "common.next" | default "Next" }} → + {{ lang.Translate "common.next" | default "Next" }} → </a> {{- end }} </nav> diff --git a/layouts/partials/list/post-card.html b/layouts/partials/list/post-card.html index 75be9ce..254cc6b 100644 --- a/layouts/partials/list/post-card.html +++ b/layouts/partials/list/post-card.html @@ -10,11 +10,17 @@ <time datetime="{{ $post.Date.Format "2006-01-02T15:04:05Z07:00" }}" class="post-card__publish-date"> {{ $post.Date | time.Format ":date_medium" }} </time> - {{- with $post.ReadingTime }} - <p class="post-card__reading-time"> - {{ lang.Translate "list.reading_time" . | default (printf "Estimated reading time: %s min" .) }} - </p> - {{- end }} + <!-- Uncomment for post meta info + <p class="post-card__meta-info"> + <span class="post-card__reading-time"> + {{ lang.Translate "list.reading_time" $post.ReadingTime | default (printf "Estimated reading time: %s min" $post.ReadingTime) }} + </span> + | + <span class="post-card__word-count"> + {{ lang.Translate "list.word_count" $post.WordCount | default (printf "%s words" $post.WordCount) }} + </span> + </p> + --> </div> </header> diff --git a/layouts/partials/list/recent-posts.html b/layouts/partials/list/recent-posts.html index d774138..2404910 100644 --- a/layouts/partials/list/recent-posts.html +++ b/layouts/partials/list/recent-posts.html @@ -18,10 +18,7 @@ List of specified number of the most recent and published posts. Accepts a dict </h2> </header> - {{- $recentPosts := where site.RegularPages "Date" "!=" nil }} - {{- $recentPosts = where $recentPosts ".Date" "le" now }} - {{- $recentPosts = first $count $recentPosts }} - + {{- $recentPosts := where site.RegularPages "Params.excludeFromLists" "!=" true | first $count }} {{- if $recentPosts }} <div class="recent-posts__content"> <ul class="recent-posts__list" role="list"> @@ -33,16 +30,16 @@ List of specified number of the most recent and published posts. Accepts a dict </ul> {{- if $showViewAll }} - <a href="{{ with site.GetPage "/posts" }}{{ .RelPermalink }}{{ else }}/posts/{{ end }}" class="recent-posts__view-all-link"> - {{ lang.Translate "posts.view_all" | default "View all posts" }} + {{- with site.GetPage "/all-posts"}} + <a href="{{ .RelPermalink }}" class="recent-posts__view-all-link"> + {{ lang.Translate "posts.view_all" | default "View all posts" }} » </a> + {{- end }} {{- end }} </div> {{ else }} - <div class="recent-posts__empty"> - <p class="recent-posts__empty-message"> - {{ lang.Translate "list.empty" | default "No posts in this section." }} - </p> - </div> + <p class="recent-posts__empty-message"> + {{ lang.Translate "list.empty" | default "No posts in this section." }} + </p> {{- end }} </section> diff --git a/layouts/partials/navmenu.html b/layouts/partials/navmenu.html index 91e53b3..e833168 100644 --- a/layouts/partials/navmenu.html +++ b/layouts/partials/navmenu.html @@ -1,6 +1,5 @@ {{- /* -Simplified version of the `hugo new template` menu.html default -Renders a menu for the given menu ID. +Simplified version of the `hugo new template` menu.html default. Renders a menu for the given menu ID. @context {page} page: The current page. @context {string} menuID: The menu ID. diff --git a/layouts/partials/select-theme.html b/layouts/partials/select-theme.html index 443e056..3d82bd6 100644 --- a/layouts/partials/select-theme.html +++ b/layouts/partials/select-theme.html @@ -6,10 +6,10 @@ data-label-dark="{{ lang.Translate "theme.toggle_dark" }}" data-label-light="{{ lang.Translate "theme.toggle_light" }}" > - <svg class="icon icon-moon" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 16 16" aria-hidden="true"> - <path fill="currentColor" d="M6 .278a.768.768 0 0 1 .08.858a7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277c.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316a.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71C0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z"></path> - </svg> - <svg class="icon icon-sun" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 16 16" aria-hidden="true"> - <path fill="currentColor" d="M8 12a4 4 0 1 0 0-8a4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"/> - </svg> + <svg class="icon icon-moon" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 16 16" aria-hidden="true"> + <path fill="currentColor" d="M6 .278a.768.768 0 0 1 .08.858a7.208 7.208 0 0 0-.878 3.46c0 4.021 3.278 7.277 7.318 7.277c.527 0 1.04-.055 1.533-.16a.787.787 0 0 1 .81.316a.733.733 0 0 1-.031.893A8.349 8.349 0 0 1 8.344 16C3.734 16 0 12.286 0 7.71C0 4.266 2.114 1.312 5.124.06A.752.752 0 0 1 6 .278z"></path> + </svg> + <svg class="icon icon-sun" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 16 16" aria-hidden="true"> + <path fill="currentColor" d="M8 12a4 4 0 1 0 0-8a4 4 0 0 0 0 8zM8 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 0zm0 13a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0v-2A.5.5 0 0 1 8 13zm8-5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2a.5.5 0 0 1 .5.5zM3 8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1 0-1h2A.5.5 0 0 1 3 8zm10.657-5.657a.5.5 0 0 1 0 .707l-1.414 1.415a.5.5 0 1 1-.707-.708l1.414-1.414a.5.5 0 0 1 .707 0zm-9.193 9.193a.5.5 0 0 1 0 .707L3.05 13.657a.5.5 0 0 1-.707-.707l1.414-1.414a.5.5 0 0 1 .707 0zm9.193 2.121a.5.5 0 0 1-.707 0l-1.414-1.414a.5.5 0 0 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .707zM4.464 4.465a.5.5 0 0 1-.707 0L2.343 3.05a.5.5 0 1 1 .707-.707l1.414 1.414a.5.5 0 0 1 0 .708z"/> + </svg> </button> diff --git a/layouts/partials/single/next-prev.html b/layouts/partials/single/next-prev.html index 1c0b462..b80e39a 100644 --- a/layouts/partials/single/next-prev.html +++ b/layouts/partials/single/next-prev.html @@ -21,7 +21,7 @@ {{ lang.Translate "post.next" | default "Next post:" }} </span> <span class="post__navigation-title"> - → {{ .Title }} + {{ .Title }} → </span> </a> </li> diff --git a/layouts/tags/term.html b/layouts/tags/term.html index d3d8b6a..bbdc0bf 100644 --- a/layouts/tags/term.html +++ b/layouts/tags/term.html @@ -17,7 +17,7 @@ <section class="tag-page__content" aria-label="{{ lang.Translate "tags.posts_list" | default "Posts with this tag:" }}"> {{- with .Pages }} - <ul class="tag-page__posts"> + <ul class="tag-page__posts-list"> {{- range . }} <li class="tag-page__post"> {{- partial "list/post-card.html" . }} @@ -33,8 +33,8 @@ <footer class="tag-page__footer"> <nav class="tag-page__navigation" aria-label="{{ lang.Translate "tags.navigation" | default "Tag navigation" }}"> - <a href="{{ .Parent.RelPermalink }}" class="tag-page__list-all-link"> - ← {{ lang.Translate "tags.all_tags" | default "All tags" }} + <a href="{{ .Parent.RelPermalink }}" class="tag-page__view-all-link"> + {{ lang.Translate "tags.all_tags" | default "All tags" }} » </a> </nav> </footer> |
