diff options
| -rw-r--r-- | hugo.toml | 49 | ||||
| -rw-r--r-- | i18n/de.toml | 46 | ||||
| -rw-r--r-- | i18n/en.toml | 46 | ||||
| -rw-r--r-- | layouts/404.html | 9 | ||||
| -rw-r--r-- | layouts/_default/baseof.html | 18 | ||||
| -rw-r--r-- | layouts/_default/list.html | 33 | ||||
| -rw-r--r-- | layouts/_default/single.html | 19 | ||||
| -rw-r--r-- | layouts/index.html | 22 | ||||
| -rw-r--r-- | layouts/partials/footer.html | 4 | ||||
| -rw-r--r-- | layouts/partials/head/meta.html | 21 | ||||
| -rw-r--r-- | layouts/partials/head/seo.html | 86 | ||||
| -rw-r--r-- | layouts/partials/header.html | 6 | ||||
| -rw-r--r-- | layouts/partials/list/pagination.html | 28 | ||||
| -rw-r--r-- | layouts/partials/list/post-card.html | 45 | ||||
| -rw-r--r-- | layouts/partials/list/recent-posts.html | 50 | ||||
| -rw-r--r-- | layouts/partials/navmenu.html | 58 | ||||
| -rw-r--r-- | layouts/partials/single/next-prev.html | 30 | ||||
| -rw-r--r-- | layouts/partials/single/tags.html | 17 | ||||
| -rw-r--r-- | layouts/tags/list.html | 37 | ||||
| -rw-r--r-- | layouts/tags/term.html | 42 |
20 files changed, 552 insertions, 114 deletions
@@ -2,29 +2,38 @@ baseURL = "https://example.org/" languageCode = "en-US" title = "Your Website Name" +[frontmatter] + # {{ .Date }} will look for publishDate or aliases first, fallback to date + date = ["publishdate", "pubdate", "published", "date"] + [menus] - [[menus.main]] - name = "Home" - pageRef = "/" - weight = 10 + [[menus.main]] + identifier = "home" + name = "Home" + pageRef = "/" + weight = 10 - [[menus.main]] - name = "Posts" - pageRef = "/posts" - weight = 20 + [[menus.main]] + identifier = "posts" + name = "Posts" + pageRef = "/posts" + weight = 20 - [[menus.main]] - name = "About" - pageRef = "/about" - weight = 30 + [[menus.main]] + identifier = "about" + name = "About" + pageRef = "/about" + weight = 30 - [[menus.main]] - name = "Tags" - pageRef = "/tags" - weight = 40 + [[menus.main]] + identifier = "tags" + name = "Tags" + pageRef = "/tags" + weight = 40 [params] - [params.author] - name = "Your Name" - email = "your@email.com" - + [params.author] + name = "Your Name" + email = "your@email.com" + # Set logo to empty string in your hugo.toml if you want to display site.Title instead + logo = "logo.svg" diff --git a/i18n/de.toml b/i18n/de.toml new file mode 100644 index 0000000..fb65774 --- /dev/null +++ b/i18n/de.toml @@ -0,0 +1,46 @@ +# GERMAN translations +[common] + more = "mehr" + next = "Weiter" + previous = "Zurück" + +[header] + navmenu = "Webseiten Navigation" + +[list] + default_description = "Alle Beiträge in {{ . }}" + empty = "Keine Beiträge in diesem Bereich." + reading_time= "Geschätzte Lesezeit: {{ . }} min" + +[pagination] + current = "Aktuelle Seite" + go_to = "Gehe zu Seite" + label = "Seiten Navigation" + next_page = "Nächste Seite" + position = "Seite {{ . }} von {{ . }}" + previous_page = "Vorherige Seite" + +[posts] + name = "Beiträge" + navigation = "Beitrag Navigation" + next = "Nächster Beitrag:" + previous = "Vorheriger Beitrag:" + recent = "Neueste Beiträge" + view_all = "Alle Beiträge" + +[tags] + all = "Alle Schlagwörter" + empty = "Keine Schlagwörter gefunden." + name = "Schlagwörter" + navigation = "Schlagwörter Navigation" + no_posts = "Keine Artikel mit diesem Schlagwort gefunden." + overview_all = "Übersicht aller Themen auf dieser Webseite:" + postcount_number = "{{ . }} Artikel gefunden" + postcount_title = "Anzahl der Artikel" + posts_list = "Artikel mit diesem Schlagwort:" + tagged_with = "Getaggt mit:" + +[404] + title = "Seite nicht gefunden" + description = "Die angefragte Seite existiert nicht." + homepage = "Zurück zur Startseite" diff --git a/i18n/en.toml b/i18n/en.toml new file mode 100644 index 0000000..690db3c --- /dev/null +++ b/i18n/en.toml @@ -0,0 +1,46 @@ +# ENGLISH translations +[common] + more = "more" + next = "Next" + previous = "Previous" + +[header] + navmenu = "Website navigation" + +[list] + default_description = "All posts in {{ . }}" + empty = "No posts in this section." + reading_time= "Estimated reading time: {{ . }} min" + +[pagination] + current = "Current page" + go_to = "Go to page" + label = "Page navigation" + next_page = "Next page" + position = "Page {{ . }} of {{ . }}" + previous_page = "Previous page" + +[posts] + name = "Posts" + navigation = "Post navigation" + next = "Next post:" + previous = "Previous post:" + recent = "Recent Posts" + view_all = "View all posts" + +[tags] + all = "All tags" + empty = "No tags found." + name = "Tags" + navigation = "Tag navigation" + no_posts = "No posts found with this tag." + overview_all = "Overview of all topics covered on this site:" + postcount_number = "{{ . }} posts found" + postcount_title = "Number of posts" + posts_list = "Posts with this tag:" + tagged_with = "Tagged with:" + +[404] + title = "Page not found" + description = "The requested page does not exist." + homepage = "Back to the homepage" diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..9859cd3 --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,9 @@ +{{- define "main" }} +<h1>{{ lang.Translate "404.title" | default "Page not found" }}</h1> +<p>{{ lang.Translate "404.description" | default "The requested page does not exist" }}</p> +<p> + <a href="{{ site.Home.RelPermalink }}"> + {{ lang.Translate "404.homepage" | default "Back to the homepage" }} + </a> +</p> +{{- end }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 3ca9201..3c4865b 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="{{ site.Language.LanguageCode }}" dir="{{ or site.Language.LanguageDirection `ltr` }}"> +<html lang="{{ .Language.LanguageCode }}" dir="{{ .Language.LanguageDirection | default "ltr" }}"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> @@ -9,7 +9,7 @@ <meta name="description" content="{{ . }}"> {{- else }} {{- if or .IsPage .IsSection}} - <meta name="description" content="{{ .Summary | plainify | default (printf "%s - %s" .Title site.Title) }}"> + <meta name="description" content="{{ .Summary | plainify | default (printf "%s | %s" .Title site.Title) }}"> {{- else }} <meta name="description" content="{{ site.Params.description | default site.Title }}"> {{- end }} @@ -19,20 +19,20 @@ <link rel="canonical" href="{{ .Permalink }}"> {{- if .IsTranslated }} - {{ range .Translations }} + {{- range .Translations }} <link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}"> - {{ end }} + {{- end }} {{- end }} - {{ partial "head/meta.html" . }} - {{ partial "head/seo.html" . }} - {{ partialCached "head/css.html" . }} + {{- partial "head/meta.html" . }} + {{- partial "head/seo.html" . }} + {{- partialCached "head/css.html" . }} </head> - <body class="{{ .Type | default "page" }} {{ .Lang }}"> + <body class="{{ .Type | default "page" }}"> {{ partial "header.html" . }} - <main id="main" role="main"> + <main id="main-content" class="site__main" role="main"> {{ block "main" . }}{{ end }} </main> diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e69de29..8ff9b18 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -0,0 +1,33 @@ +{{- define "main" }} +<section class="section-list"> + <header class="section-list__header"> + <h1 class="section-list__headline"> + {{ .Title }} + </h1> + {{- $description := or .Description .Summary (lang.Translate "list.default_description" .Title | default (printf "All posts in %s" .Title)) }} + <p class="section-list__description"> + {{ $description }} + </p> + </header> + + <section class="section-list__content" aria-label="{{ lang.Translate "posts.name" | default "Posts" }}"> + {{- /* 20 posts per site */ -}} + {{- $paginator := .Paginate .Pages 20 }} + {{- with $paginator.Pages }} + <ul class="section-list__posts"> + {{- range . }} + <li class="section-list__post"> + {{- partial "list/post-card.html" . }} + </li> + {{- end }} + </ul> + {{- else }} + <p class="section-list__empty-message"> + {{ lang.Translate "list.empty" | default "No posts found in this section." }} + </p> + {{- end }} + </section> + + {{- partial "list/pagination.html" $paginator }} +</section> +{{- end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index e69de29..24bc5c9 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -0,0 +1,19 @@ +{{- define "main" }} +<article class="post"> + <header class="post__header"> + <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> + </header> + + <div class="post__content"> + {{ .Content }} + </div> + + <footer class="post__footer"> + {{ partial "single/tags" . }} + {{ partial "single/next-prev" . }} + </footer> +</article> +{{- end }} diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..127af83 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,22 @@ +{{- /* HOMEPAGE */ -}} +{{- define "main" }} +<div class="homepage"> + <header class="homepage__hero"> + <h1 class="homepage__title"> + {{ with .Title }}{{ . }}{{ else }}{{ site.Title | default "Welcome to my Blog!" }}{{ end }} + </h1> + {{- with .Content }} + <div class="homepage__content"> + {{ . }} + </div> + {{- end }} + </header> + + {{- partial "list/recent-posts.html" (dict + "count" 10 + "title" (lang.Translate "posts.recent" | default "Recent Articles") + "show_view_all" true + ) + -}} +</div> +{{- end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index a74a6a4..a934e59 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,3 +1,3 @@ -<footer role="contentinfo"> - <p>© {{ now.Year }} {{ site.Params.author.name }}</p> +<footer class="site__footer" role="contentinfo"> + <p>© {{ now.Year }} {{ site.Params.author.name }}</p> </footer> diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html index d0358a1..f739838 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -1,22 +1,27 @@ -<!-- Basic Meta --> +{{- /* Basic Meta */ -}} <meta name="author" content="{{ site.Params.author.name | default site.Title }}"> <meta name="robots" content="index, follow"> -<!-- Open Graph (OG) --> +{{- /* Open Graph */ -}} <meta property="og:title" content="{{ .Title | default site.Title }}"> <meta property="og:description" content="{{ .Description | default .Summary }}"> <meta property="og:type" content="{{ if .IsHome }}website{{ else }}article{{ end }}"> <meta property="og:url" content="{{ .Permalink }}"> <meta property="og:site_name" content="{{ site.Title }}"> -{{- with .Params.images }} - <meta property="og:image" content="{{ (index . 0) | absURL }}"> +{{- with site.Params.logo }} + <meta property="og:image" content="{{ . | absURL }}"> +{{- end }} +{{- if .IsPage }} + <meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}"> + {{- with .Lastmod }} + <meta property="article:modified_time" content="{{ .Format "2006-01-02T15:04:05Z07:00" }}"> + {{- end }} {{- end }} -<!-- Twitter Card --> +{{- /* Twitter Card */ -}} <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:title" content="{{ .Title | default site.Title }}"> <meta name="twitter:description" content="{{ .Description | default .Summary }}"> -{{- with .Params.images }} - <meta name="twitter:image" content="{{ (index . 0) | absURL }}"> +{{- with site.Params.logo }} + <meta name="twitter:image" content="{{ . | absURL }}"> {{- end }} - diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html index 2c617e1..628ea2c 100644 --- a/layouts/partials/head/seo.html +++ b/layouts/partials/head/seo.html @@ -1,50 +1,46 @@ -{{ if .IsPage }} - <script type="application/ld+json"> - { - "@context": "https://schema.org", - "@type": "Article", - "headline": {{ printf "%q" .Title }}, +<script type="application/ld+json"> +{ + "@context": "https://schema.org", + "@type": "{{ if .IsPage }}Article{{ else }}WebSite{{ end }}", + "url": {{ .Permalink }}, + "name": {{ with .Title }}{{ . }}{{ else }}{{ site.Title }}{{ end }}, + "headline": {{ with .Title }}{{ . }}{{ else }}{{ site.Title }}{{ end }}, + "description": {{ with .Description }}{{ . }}{{ else }}{{ site.Params.description | default site.Title }}{{ end }}, + {{- with .Params.images }} + "image": [ + {{- range $i, $image := . }} + {{- if $i }},{{ end }} + "{{ $image | absURL }}" + {{- end }} + ], + {{- else }} + {{- with site.Params.logo }} + "image": ["{{ . | absURL }}"], + {{- end }} + {{- end }} + {{- if .IsPage }} "datePublished": "{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}", - {{ with .Lastmod }} - "dateModified": "{{ .Format "2006-01-02T15:04:05Z07:00" }}", - {{ end }} - "author": { - "@type": "Person", - "name": {{ printf "%q" (site.Params.author.name | default site.Title) }} - }, - "publisher": { - "@type": "Person", - "name": {{ printf "%q" site.Title }}, - "logo": { - "@type": "ImageObject", - "url": "{{ site.Params.logo | absURL }}" - } + {{- with .Lastmod }} + "dateModified": "{{ .Format "2006-01-02T15:04:05Z07:00" }}", + {{- end }} + {{- end }} + "author": { + "@type": "Person", + "name": "{{ site.Params.author.name | default site.Title }}" + }, + "publisher": { + "@type": "Organization", + "name": "{{ site.Title }}" + {{- with site.Params.logo }}, + "logo": { + "@type": "ImageObject", + "url": "{{ . | absURL }}" + } + {{- end }} }, "mainEntityOfPage": { "@type": "WebPage", - "@id": "{{ .Permalink }}" - }, - "image": [ - {{ with .Params.images }}"{{ (index . 0) | absURL }}"{{ end }} - ] - } - </script> -{{ else if .IsHome }} - <script type="application/ld+json"> - { - "@context": "https://schema.org", - "@type": "WebSite", - "url": "{{ site.BaseURL }}", - "name": {{ printf "%q" site.Title }}, - "author": { - "@type": "Person", - "name": {{ printf "%q" (site.Params.author.name | default site.Title) }} - }, - "publisher": { - "@type": "Person", - "name": {{ printf "%q" site.Title }} - } + "@id": {{ .Permalink }} } - </script> -{{ end }} - +} +</script> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index a496628..7b728a6 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,6 +1,6 @@ -<header role="banner"> - <a href="{{ site.Home.RelPermalink }}" rel="home" class="site-title"> - {{ site.Title }} +<header class="site__header" role="banner"> + <a href="{{ site.Home.RelPermalink }}" rel="home" class="site-{{ if site.Params.logo }}logo{{ else }}title{{ end }}"> + {{ with site.Params.logo}}{{ . }}{{ else }}{{ site.Title }}{{end}} </a> {{ partial "navmenu.html" (dict "menuID" "main" "page" .) }} diff --git a/layouts/partials/list/pagination.html b/layouts/partials/list/pagination.html new file mode 100644 index 0000000..47d90ff --- /dev/null +++ b/layouts/partials/list/pagination.html @@ -0,0 +1,28 @@ +{{- $paginator := . }} +{{- if gt $paginator.TotalPages 1 }} +<nav class="pagination" aria-label="{{ lang.Translate "pagination.label" | default "Page navigation" }}"> + {{- if $paginator.HasPrev }} + <a href="{{ $paginator.Prev.URL }}" + class="pagination__link" + rel="prev" + aria-label="{{ lang.Translate "pagination.previous_page" | default "Previous page" }}" + > + ← {{ lang.Translate "common.previous" | default "Previous" }} + </a> + {{- end }} + + <p class="pagination__current"> + {{ lang.Translate "pagination.position" $paginator.PageNumber $paginator.TotalPages | default (printf "Page %d of %d" $paginator.PageNumber $paginator.TotalPages) }} + </p> + + {{- if $paginator.HasNext }} + <a href="{{ $paginator.Next.URL }}" + class="pagination__link" + rel="next" + aria-label="{{ lang.Translate "pagination.next_page" | default "Next page" }}" + > + {{ lang.Translate "common.next" | default "Next" }} → + </a> + {{- end }} +</nav> +{{- end }} diff --git a/layouts/partials/list/post-card.html b/layouts/partials/list/post-card.html new file mode 100644 index 0000000..12eada4 --- /dev/null +++ b/layouts/partials/list/post-card.html @@ -0,0 +1,45 @@ +{{- $post := . }} +<article class="post-card"> + <header class="post-card__header"> + <h3 class="post-card__title"> + <a href="{{ $post.RelPermalink }}" class="post-card__link"> + {{ $post.Title }} + </a> + </h3> + <div class="post-card__meta"> + <time datetime="{{ $post.Date.Format "2006-01-02T15:04:05Z07:00" }}" class="post-card__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 }} + </div> + </header> + + {{- with $post.Summary }} + <div class="post-card__summary"> + {{ . }} + </div> + {{- end }} + + {{- with $post.Params.tags }} + <footer class="post-card__tags"> + <ul class="post-card__tags-list"> + {{- range first 3 . }} + <li class="post-card__tags-item"> + #{{ . }} + </li> + {{- end }} + {{- if gt (len .) 3 }} + <li class="post-card__tags-item post-card__tags-more"> + <span class="post-card__tags-more-count"> + +{{ sub (len .) 3 }} {{ lang.Translate "common.more" | default "more" }} + </span> + </li> + {{- end }} + </ul> + </footer> + {{- end }} +</article> diff --git a/layouts/partials/list/recent-posts.html b/layouts/partials/list/recent-posts.html new file mode 100644 index 0000000..c1075e2 --- /dev/null +++ b/layouts/partials/list/recent-posts.html @@ -0,0 +1,50 @@ +{{- /* +List of Recent Posts. Accepts a dict with the following optional parameters: + +@context {int} count: Number of posts to display (default: 10). +@context {string} title: Section title (default: "Recent Articles"). +@context {bool} show_view_all: Whether to show "View All Posts" link (default: true). + +@example: {{ partial "list/recent-posts.html" (dict "count" 20 "title" "Latest updates" "show_view_all" true) }} +*/ -}} + +{{- $count := .count | default 10 -}} +{{- $title := .title | default (lang.Translate "posts.recent" | default "Recent Articles") -}} +{{- $showViewAll := .show_view_all | default true -}} + +<section class="recent-posts" aria-labelledby="recent-posts-heading"> + <header class="recent-posts__header"> + <h2 id="recent-posts-heading" class="recent-posts__title"> + {{ $title }} + </h2> + </header> + + {{- /* Get published 10 most recent posts */ -}} + {{- $recentPosts := where site.RegularPages "Date" "!=" nil }} + {{- $recentPosts = where $recentPosts ".Date" "le" now }} + {{- $recentPosts = first $count $recentPosts }} + + {{- if $recentPosts }} + <div class="recent-posts__content"> + <ul class="recent-posts__list" role="list"> + {{- range $recentPosts }} + <li class="recent-posts__list-item"> + {{- partial "list/post-card.html" . }} + </li> + {{- end }} + </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" }} + </a> + {{- 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> + {{- end }} +</section> diff --git a/layouts/partials/navmenu.html b/layouts/partials/navmenu.html index 05fd64f..91e53b3 100644 --- a/layouts/partials/navmenu.html +++ b/layouts/partials/navmenu.html @@ -1,45 +1,49 @@ {{- /* +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. +@context {page} page: The current page. +@context {string} menuID: The menu ID. @example: {{ partial "navmenu.html" (dict "menuID" "main" "page" .) }} */}} -{{- $page := .page }} +{{- $currentPage := .page }} {{- $menuID := .menuID }} {{- with index site.Menus $menuID }} - <nav role="navigation" aria-label="{{ i18n "mainNavigation" | default "Main navigation" }}"> - <ul> - {{ range . }} - {{- $attrs := dict "href" .URL }} - {{- if $page.IsMenuCurrent .Menu . }} - {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }} - {{- else if $page.HasMenuCurrent .Menu .}} - {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }} - {{- end }} - {{- $name := .Name }} +<nav role="navigation" aria-label="{{ lang.Translate "header.navmenu" | default "Site navigation" }}" class="header__navigation"> + <ul class="header__navigation-list"> + {{- range . }} + {{- $isCurrentPage := $currentPage.IsMenuCurrent .Menu . }} + {{- $isAncestorPage := $currentPage.HasMenuCurrent .Menu . }} + {{- $isActive := or $isCurrentPage $isAncestorPage }} + {{- $menuItemName := .Name }} + + {{- $attrs := dict "href" .URL }} + {{- if $currentPage.IsMenuCurrent .Menu . }} + {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }} + {{- else if $currentPage.HasMenuCurrent .Menu .}} + {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }} + {{- end }} + <!-- Translations --> {{- with .Identifier }} - {{- with T . }} - {{- $name = . }} + {{- with lang.Translate . }} + {{- $menuItemName = . }} {{- end }} {{- end }} - <li> + + <li class="header__navigation--list-item"> <a - {{- range $k, $v := $attrs }} - {{- with $v }} - {{- printf " %s=%q" $k $v | safeHTMLAttr }} - {{- end }} - {{- end -}} + href="{{ .URL }}" + class="header__navigation-link{{ if $isActive }} header__navigation-link--active{{ end }}" + aria-current="{{ if $isCurrentPage }}page{{ else if $isAncestorPage }}true{{ end }}" > - {{ $name }} + {{ $menuItemName }} </a> </li> - {{- end }} - </ul> - </nav> -{{- end }} - + {{- end }} + </ul> +</nav> +{{- end -}} diff --git a/layouts/partials/single/next-prev.html b/layouts/partials/single/next-prev.html new file mode 100644 index 0000000..c938990 --- /dev/null +++ b/layouts/partials/single/next-prev.html @@ -0,0 +1,30 @@ +{{- /* Navigation for Next and Previous Post */ -}} +<nav class="post__navigation" aria-label="{{ lang.Translate "post.navigation" | default "Post navigation" }}"> + <ul class="post__navigation-list"> + {{- with .PrevInSection }} + <li class="post__navigation-prev"> + <a href="{{ .RelPermalink }}" class="post__navigation-link" rel="prev"> + <span class="post__navigation-label"> + {{ lang.Translate "post.previous" | default "Previous post:" }} + </span> + <span class="post__navigation-title"> + {{ .Title }} + </span> + </a> + </li> + {{- end }} + + {{- with .NextInSection }} + <li class="post__navigation-next"> + <a href="{{ .RelPermalink }}" class="post__navigation-link" rel="next"> + <span class="post__navigation-label"> + {{ lang.Translate "post.next" | default "Next post:" }} + </span> + <span class="post__navigation-title"> + {{ .Title }} + </span> + </a> + </li> + {{- end }} + </ul> +</nav> diff --git a/layouts/partials/single/tags.html b/layouts/partials/single/tags.html new file mode 100644 index 0000000..e90b909 --- /dev/null +++ b/layouts/partials/single/tags.html @@ -0,0 +1,17 @@ +{{- with .GetTerms "tags" }} +<section class="post__tags" aria-labelledby="tags-heading"> + <h2 id="tags-heading" class="post__tags-heading"> + {{ lang.Translate "tags.name" | default "Tags" }} + </h2> + + <ul class="post__tags-list"> + {{- range . }} + <li class="post__tags-item"> + <a href="{{ .RelPermalink }}" class="post__tags-link" rel="tag"> + {{ .Title }} + </a> + </li> + {{- end }} + </ul> +</section> +{{- end }} diff --git a/layouts/tags/list.html b/layouts/tags/list.html new file mode 100644 index 0000000..d3af0e4 --- /dev/null +++ b/layouts/tags/list.html @@ -0,0 +1,37 @@ +{{- /* List of All Tags */ -}} +{{- define "main" }} +<article class="tags-index"> + <header class="tags-index__header"> + <h1 class="tags-index__headline"> + {{ lang.Translate "tags.all" | default "All Tags" }} + </h1> + <p class="tags-index__description"> + {{ lang.Translate "tags.overview_all" | default "Overview of all topics covered on this site." }} + </p> + </header> + + <section class="tags-index__content" aria-label="{{ lang.Translate "tags.all" | default "All Tags" }}"> + {{- with site.Taxonomies.tags }} + {{ $tags := .Alphabetical }} + <ul class="tags-index__list"> + {{- range $tags }} + <li class="tags-index__item"> + <a href="{{ .Page.RelPermalink }}" class="tags-index__link" rel="tag"> + <span class="tags-index__name"> + {{ .Page.Title }} + </span> + <span class="tags-index__count" aria-label="{{ lang.Translate "tags.postcount_title" | default "Number of posts" }}"> + ({{ .Count }}) + </span> + </a> + </li> + {{- end }} + </ul> + {{- else }} + <p class="tags-index__empty"> + {{ lang.Translate "tags.empty" | default "No tags found." }} + </p> + {{- end }} + </section> +</article> +{{- end }} diff --git a/layouts/tags/term.html b/layouts/tags/term.html new file mode 100644 index 0000000..e107123 --- /dev/null +++ b/layouts/tags/term.html @@ -0,0 +1,42 @@ +{{- /* List of All Articles for a Specific Tag */ -}} +{{- define "main" }} +<article class="tag-page"> + <header class="tag-page__header"> + <h1 class="tag-page__headline"> + <span class="tag-page__label"> + {{ lang.Translate "tags.tagged_with" | default "Tagged with:" }} + </span> + <span class="tag-page__name"> + #{{ .Title }} + </span> + </h1> + <p class="tag-page__count"> + {{ lang.Translate "tags.postcount_number" .Pages.Len | default (printf "%d posts found" .Pages.Len) }} + </p> + </header> + + <section class="tag-page__content" aria-label="{{ lang.Translate "tags.posts_list" | default "Posts with this tag:" }}"> + {{- with .Pages }} + <ul class="tag-page__posts"> + {{- range . }} + <li class="tag-page__post"> + {{- partial "list/post-card.html" . }} + </li> + {{- end }} + </ul> + {{- else }} + <p class="tag-page__empty"> + {{ lang.Translate "tags.no_posts" | default "No posts found with this tag." }} + </p> + {{- end }} + </section> + + <footer class="tag-page__footer"> + <nav class="tag-page__navigation" aria-label="{{ lang.Translate "tags.navigation" | default "Tag navigation" }}"> + <a href="{{ "/tags/" | relURL }}" class="tag-page__back-link"> + ← {{ lang.Translate "tags.all_tags" | default "All tags" }} + </a> + </nav> + </footer> +</article> +{{- end }} |
