From f0506acd6f70da636b8fdb23439c85bbf2392b40 Mon Sep 17 00:00:00 2001 From: Arne Rief Date: Sat, 16 Aug 2025 22:42:03 +0200 Subject: HTML templates done --- hugo.toml | 49 +++++++++++-------- i18n/de.toml | 46 ++++++++++++++++++ i18n/en.toml | 46 ++++++++++++++++++ layouts/404.html | 9 ++++ layouts/_default/baseof.html | 18 +++---- layouts/_default/list.html | 33 +++++++++++++ layouts/_default/single.html | 19 ++++++++ layouts/index.html | 22 +++++++++ layouts/partials/footer.html | 4 +- layouts/partials/head/meta.html | 21 +++++--- layouts/partials/head/seo.html | 86 ++++++++++++++++----------------- layouts/partials/header.html | 6 +-- layouts/partials/list/pagination.html | 28 +++++++++++ layouts/partials/list/post-card.html | 45 +++++++++++++++++ layouts/partials/list/recent-posts.html | 50 +++++++++++++++++++ layouts/partials/navmenu.html | 58 +++++++++++----------- layouts/partials/single/next-prev.html | 30 ++++++++++++ layouts/partials/single/tags.html | 17 +++++++ layouts/tags/list.html | 37 ++++++++++++++ layouts/tags/term.html | 42 ++++++++++++++++ 20 files changed, 552 insertions(+), 114 deletions(-) create mode 100644 i18n/de.toml create mode 100644 i18n/en.toml create mode 100644 layouts/404.html create mode 100644 layouts/index.html create mode 100644 layouts/partials/list/pagination.html create mode 100644 layouts/partials/list/post-card.html create mode 100644 layouts/partials/list/recent-posts.html create mode 100644 layouts/partials/single/next-prev.html create mode 100644 layouts/partials/single/tags.html create mode 100644 layouts/tags/list.html create mode 100644 layouts/tags/term.html diff --git a/hugo.toml b/hugo.toml index f5c9f60..ae54cbe 100644 --- a/hugo.toml +++ b/hugo.toml @@ -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" }} +

{{ lang.Translate "404.title" | default "Page not found" }}

+

{{ lang.Translate "404.description" | default "The requested page does not exist" }}

+

+ + {{ lang.Translate "404.homepage" | default "Back to the homepage" }} + +

+{{- 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 @@ - + @@ -9,7 +9,7 @@ {{- else }} {{- if or .IsPage .IsSection}} - + {{- else }} {{- end }} @@ -19,20 +19,20 @@ {{- if .IsTranslated }} - {{ range .Translations }} + {{- range .Translations }} - {{ 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" . }} - + {{ partial "header.html" . }} -
+
{{ block "main" . }}{{ end }}
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" }} +
+
+

+ {{ .Title }} +

+ {{- $description := or .Description .Summary (lang.Translate "list.default_description" .Title | default (printf "All posts in %s" .Title)) }} +

+ {{ $description }} +

+
+ +
+ {{- /* 20 posts per site */ -}} + {{- $paginator := .Paginate .Pages 20 }} + {{- with $paginator.Pages }} +
    + {{- range . }} +
  • + {{- partial "list/post-card.html" . }} +
  • + {{- end }} +
+ {{- else }} +

+ {{ lang.Translate "list.empty" | default "No posts found in this section." }} +

+ {{- end }} +
+ + {{- partial "list/pagination.html" $paginator }} +
+{{- 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" }} +
+
+

{{ .Title }}

+ +
+ +
+ {{ .Content }} +
+ +
+ {{ partial "single/tags" . }} + {{ partial "single/next-prev" . }} +
+
+{{- 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" }} +
+
+

+ {{ with .Title }}{{ . }}{{ else }}{{ site.Title | default "Welcome to my Blog!" }}{{ end }} +

+ {{- with .Content }} +
+ {{ . }} +
+ {{- end }} +
+ + {{- partial "list/recent-posts.html" (dict + "count" 10 + "title" (lang.Translate "posts.recent" | default "Recent Articles") + "show_view_all" true + ) + -}} +
+{{- 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 @@ -