From f8541ef965ca22e746b523eb418e47cb4f78f2d8 Mon Sep 17 00:00:00 2001 From: Arne Rief Date: Fri, 9 Jan 2026 12:24:05 +0100 Subject: Upgrade to new template system from Hugo v0.146.0 --- README.md | 6 +-- assets/css/main.css | 2 +- assets/css/post-card.css | 3 +- layouts/_default/all-posts.html | 36 ---------------- layouts/_default/baseof.html | 53 ------------------------ layouts/_default/home.html | 24 ----------- layouts/_default/list.html | 39 ------------------ layouts/_default/search.html | 70 -------------------------------- layouts/_default/single.html | 23 ----------- layouts/_partials/footer.html | 41 +++++++++++++++++++ layouts/_partials/head/css.html | 21 ++++++++++ layouts/_partials/head/js.html | 16 ++++++++ layouts/_partials/head/meta.html | 27 ++++++++++++ layouts/_partials/head/seo.html | 46 +++++++++++++++++++++ layouts/_partials/header.html | 14 +++++++ layouts/_partials/list/pagination.html | 28 +++++++++++++ layouts/_partials/list/post-card.html | 66 ++++++++++++++++++++++++++++++ layouts/_partials/list/recent-posts.html | 45 ++++++++++++++++++++ layouts/_partials/navmenu.html | 48 ++++++++++++++++++++++ layouts/_partials/select-language.html | 38 +++++++++++++++++ layouts/_partials/select-theme.html | 15 +++++++ layouts/_partials/single/next-prev.html | 44 ++++++++++++++++++++ layouts/_partials/single/tags.html | 17 ++++++++ layouts/all-posts.html | 36 ++++++++++++++++ layouts/baseof.html | 53 ++++++++++++++++++++++++ layouts/home.html | 24 +++++++++++ layouts/list.html | 39 ++++++++++++++++++ layouts/partials/footer.html | 41 ------------------- layouts/partials/head/css.html | 21 ---------- layouts/partials/head/js.html | 16 -------- layouts/partials/head/meta.html | 27 ------------ layouts/partials/head/seo.html | 46 --------------------- layouts/partials/header.html | 14 ------- layouts/partials/list/pagination.html | 28 ------------- layouts/partials/list/post-card.html | 66 ------------------------------ layouts/partials/list/recent-posts.html | 45 -------------------- layouts/partials/navmenu.html | 48 ---------------------- layouts/partials/select-language.html | 38 ----------------- layouts/partials/select-theme.html | 15 ------- layouts/partials/single/next-prev.html | 44 -------------------- layouts/partials/single/tags.html | 17 -------- layouts/search.html | 70 ++++++++++++++++++++++++++++++++ layouts/single.html | 23 +++++++++++ 43 files changed, 716 insertions(+), 717 deletions(-) delete mode 100644 layouts/_default/all-posts.html delete mode 100644 layouts/_default/baseof.html delete mode 100644 layouts/_default/home.html delete mode 100644 layouts/_default/list.html delete mode 100644 layouts/_default/search.html delete mode 100644 layouts/_default/single.html create mode 100644 layouts/_partials/footer.html create mode 100644 layouts/_partials/head/css.html create mode 100644 layouts/_partials/head/js.html create mode 100644 layouts/_partials/head/meta.html create mode 100644 layouts/_partials/head/seo.html create mode 100644 layouts/_partials/header.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/navmenu.html create mode 100644 layouts/_partials/select-language.html create mode 100644 layouts/_partials/select-theme.html create mode 100644 layouts/_partials/single/next-prev.html create mode 100644 layouts/_partials/single/tags.html create mode 100644 layouts/all-posts.html create mode 100644 layouts/baseof.html create mode 100644 layouts/home.html create mode 100644 layouts/list.html delete mode 100644 layouts/partials/footer.html delete mode 100644 layouts/partials/head/css.html delete mode 100644 layouts/partials/head/js.html delete mode 100644 layouts/partials/head/meta.html delete mode 100644 layouts/partials/head/seo.html delete mode 100644 layouts/partials/header.html delete mode 100644 layouts/partials/list/pagination.html delete mode 100644 layouts/partials/list/post-card.html delete mode 100644 layouts/partials/list/recent-posts.html delete mode 100644 layouts/partials/navmenu.html delete mode 100644 layouts/partials/select-language.html delete mode 100644 layouts/partials/select-theme.html delete mode 100644 layouts/partials/single/next-prev.html delete mode 100644 layouts/partials/single/tags.html create mode 100644 layouts/search.html create mode 100644 layouts/single.html diff --git a/README.md b/README.md index 63e26b0..b152149 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,10 @@ Editing the theme is simple: you only have to recreate the path and file that yo Here are three examples how to edit different aspects of the theme: ### Editing the Styling -Let's say you want to make changes to the stylesheet: in your project, create `assets/css/main.css`, then copy the CSS rules from the theme's stylesheet and add new rules or edit the existing ones for the changes you would like to have. +Let's say you want to style your footer differently: in your project, create `assets/css/footer.css`, then copy the CSS rules from the theme's correspondign stylesheet and add new rules or edit the existing ones for the changes you would like to have. ### Editing the HTML -You would like to display information like reading time and word count for each post. For this you will have to create `layouts/_default/single.html` in your project, then copy the content of the corresponding file from the theme into your own file and add the HTML and Go code for displaying this information. A block for displaying reading time and word count is already implemented in `layouts/partials/list/post-card.html`, here you would have to re-create these directories and this file in your project and simply remove the comment around the block. +You would like to display information like reading time and word count for each post. For this you will have to create `layouts/single.html` in your project, then copy the content of the corresponding file from the theme into your own file and add the HTML and Go code for displaying this information. A block for displaying reading time and word count is already implemented in `layouts/_partials/list/post-card.html`, here you would have to re-create these directories and this file in your project and simply remove the comment around the block. ### Editing JavaScript functions -In case you want to expand the results of the site-wide search, you should first look at `layouts/index.json`. That file generates data about all of your posts in JSON format. The JavaScript function for searching the site then uses that data to find matches with the user's query. So for expanding the data that will be searched by e.g. adding each post's entire content, you would have to add `"content" .Plain` to the dict in the `index.json` file first, then copy `assets/js/main.js` to your project and expand the filtering logic in the function `searchPosts()` accordingly. +In case you want to expand the results of the site-wide search, you should first look at `layouts/index.json`. That file generates data about all of your posts in JSON format. The JavaScript function for searching the site then uses that data to find matches with the user's query. So for expanding the data that will be searched by e.g. adding each post's entire content, you would have to add `"content" .Plain` to the dict in the `index.json` file first, then copy `assets/js/search.js` to your project and expand the filtering logic in the function `searchPosts()` accordingly. diff --git a/assets/css/main.css b/assets/css/main.css index c693221..b531713 100644 --- a/assets/css/main.css +++ b/assets/css/main.css @@ -85,7 +85,7 @@ main { /* Avoid affecting icon imgs in header & footer */ & img { - border-radius: var(--border-radius-default); + border-radius: var(--border-radius-minimal); max-width: 90%; @media (max-width: 768px) { diff --git a/assets/css/post-card.css b/assets/css/post-card.css index c8afb42..687b33a 100644 --- a/assets/css/post-card.css +++ b/assets/css/post-card.css @@ -1,6 +1,6 @@ /* POST CARD */ .post-card { - border: 3px solid var(--bg-special); + border: 2px solid var(--bg-special); border-radius: var(--border-radius-default); margin: 0 auto 1.5rem; padding: 0 var(--gap-default); @@ -62,7 +62,6 @@ } .post-card__section-badge { - border-radius: var(--border-radius-max); color: var(--link-color); font-size: var(--font-size-small); font-weight: bold; diff --git a/layouts/_default/all-posts.html b/layouts/_default/all-posts.html deleted file mode 100644 index 4a94ab6..0000000 --- a/layouts/_default/all-posts.html +++ /dev/null @@ -1,36 +0,0 @@ -{{ define "main" }} -
-
-

- {{ .Title }} -

- {{- with .Content }} -
- {{ . }} -
- {{- else }} - {{- $description := or .Description (lang.Translate "posts_all_description" | default "All posts on this website, from newest to oldest.") }} -

- {{ $description }} -

- {{- end }} -
- - {{ $allPosts := where site.RegularPages "Params.excludeFromLists" "!=" true }} - {{- if $allPosts }} -
-
    - {{- range $allPosts.ByDate.Reverse }} -
  • - {{ partial "list/post-card.html" (dict "post" . "show_section" true) }} -
  • - {{- end }} -
-
- {{ else }} -

- {{ lang.Translate "posts_empty" | default "This site does not have any posts yet." }} -

- {{- end }} -
-{{ end }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html deleted file mode 100644 index 99f09d9..0000000 --- a/layouts/_default/baseof.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - {{ block "title" . }}{{ if and (not .IsHome) .Title }}{{ .Title }} | {{ end }}{{ site.Title }}{{ end }} - - {{- with .Description }} - - {{- else }} - {{- if or .IsPage .IsSection}} - - {{- else }} - - {{- end }} - {{- end }} - - - - - {{- if .IsTranslated }} - {{- range .Translations }} - - {{- end }} - {{- end }} - - {{- with .OutputFormats.Get "rss" }} - {{- printf `` .Rel .MediaType.Type .Permalink site.Title | safeHTML }} - {{- end }} - - {{- partial "head/meta.html" . }} - {{- partial "head/seo.html" . }} - - - {{- partialCached "head/css.html" . }} - {{ partialCached "head/js.html" . }} - - - - {{ partial "header.html" . }} - {{ partial "navmenu.html" (dict "menuID" "main" "page" .) }} - -
- {{ block "main" . }}{{ end }} -
- - {{ partial "footer.html" . }} - - diff --git a/layouts/_default/home.html b/layouts/_default/home.html deleted file mode 100644 index 880f124..0000000 --- a/layouts/_default/home.html +++ /dev/null @@ -1,24 +0,0 @@ -{{- define "main" }} -
-
-

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

- {{- with site.Params.author.portrait }} - {{ . }} - {{- end }} - {{- with .Content }} -
- {{ . }} -
- {{- end }} -
- - {{- partial "list/recent-posts.html" (dict - "count" 5 - "title" (lang.Translate "posts_recent" | default "Recent Articles") - "show_view_all" true - ) - -}} -
-{{- end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html deleted file mode 100644 index f952e56..0000000 --- a/layouts/_default/list.html +++ /dev/null @@ -1,39 +0,0 @@ -{{- define "main" }} -
-
-

- {{ .Title }} -

- {{- with .Content }} -
- {{ . }} -
- {{- else }} - {{- $description := or .Description .Summary (lang.Translate "list_description" .Title | default (printf "All posts in %s" .Title)) }} -

- {{ $description }} -

- {{- end }} -
- -
- {{- /* 15 posts per site */ -}} - {{- $paginator := .Paginate .Pages 15 }} - {{- with $paginator.Pages }} -
    - {{- range . }} -
  • - {{- partial "list/post-card.html" (dict "post" .) }} -
  • - {{- 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/search.html b/layouts/_default/search.html deleted file mode 100644 index 6004f2e..0000000 --- a/layouts/_default/search.html +++ /dev/null @@ -1,70 +0,0 @@ -{{ define "main" }} -
-
-

- {{ .Title }} -

- {{- with .Content }} -
- {{ . }} -
- {{- else }} - {{- $description := or .Description (lang.Translate "search_description" | default "Find posts by search term.") }} -

- {{ $description }} -

- {{- end }} -
- -
- - -
- -
- - - - - {{- /* Hidden template, used for hydrating search results from index.json with JS */ -}} - - -
-
-{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html deleted file mode 100644 index e1728d3..0000000 --- a/layouts/_default/single.html +++ /dev/null @@ -1,23 +0,0 @@ -{{- define "main" }} -
-
-

- {{ .Title }} -

- {{- with .Date }} - - {{- end }} -
- -
- {{ .Content }} -
- -
- {{ partial "single/tags" . }} - {{ partial "single/next-prev" . }} -
-
-{{- end }} diff --git a/layouts/_partials/footer.html b/layouts/_partials/footer.html new file mode 100644 index 0000000..a0a30b2 --- /dev/null +++ b/layouts/_partials/footer.html @@ -0,0 +1,41 @@ + diff --git a/layouts/_partials/head/css.html b/layouts/_partials/head/css.html new file mode 100644 index 0000000..d4e894e --- /dev/null +++ b/layouts/_partials/head/css.html @@ -0,0 +1,21 @@ +{{- with resources.Get "css/main.css" -}} + {{- $allStylesheets := slice + . + (resources.Get "css/header.css") + (resources.Get "css/navmenu.css") + (resources.Get "css/footer.css") + (resources.Get "css/post-card.css") + (resources.Get "css/page.css") + (resources.Get "css/post.css") + (resources.Get "css/list-navigation.css") + (resources.Get "css/search.css") + -}} + {{- $cssBundle := $allStylesheets | resources.Concat "css/bundle.css" -}} + + {{- if hugo.IsDevelopment -}} + + {{- else -}} + {{- $css := $cssBundle | minify | fingerprint -}} + + {{- end -}} +{{- end -}} diff --git a/layouts/_partials/head/js.html b/layouts/_partials/head/js.html new file mode 100644 index 0000000..0baf831 --- /dev/null +++ b/layouts/_partials/head/js.html @@ -0,0 +1,16 @@ +{{- with resources.Get "js/main.js" }} + {{- $opts := dict + "minify" (not hugo.IsDevelopment) + "sourceMap" (cond hugo.IsDevelopment "external" "") + "targetPath" "js/main.js" + }} + {{- with . | js.Build $opts }} + {{- if hugo.IsDevelopment }} + + {{- else }} + {{- with . | fingerprint }} + + {{- end }} + {{- end }} + {{- end }} +{{- end -}} diff --git a/layouts/_partials/head/meta.html b/layouts/_partials/head/meta.html new file mode 100644 index 0000000..f739838 --- /dev/null +++ b/layouts/_partials/head/meta.html @@ -0,0 +1,27 @@ +{{- /* Basic Meta */ -}} + + + +{{- /* Open Graph */ -}} + + + + + +{{- with site.Params.logo }} + +{{- end }} +{{- if .IsPage }} + + {{- with .Lastmod }} + + {{- end }} +{{- end }} + +{{- /* Twitter Card */ -}} + + + +{{- with site.Params.logo }} + +{{- end }} diff --git a/layouts/_partials/head/seo.html b/layouts/_partials/head/seo.html new file mode 100644 index 0000000..628ea2c --- /dev/null +++ b/layouts/_partials/head/seo.html @@ -0,0 +1,46 @@ + diff --git a/layouts/_partials/header.html b/layouts/_partials/header.html new file mode 100644 index 0000000..f38b6f2 --- /dev/null +++ b/layouts/_partials/header.html @@ -0,0 +1,14 @@ + diff --git a/layouts/_partials/list/pagination.html b/layouts/_partials/list/pagination.html new file mode 100644 index 0000000..dfe8178 --- /dev/null +++ b/layouts/_partials/list/pagination.html @@ -0,0 +1,28 @@ +{{- $paginator := . }} +{{- if gt $paginator.TotalPages 1 }} + +{{- end }} diff --git a/layouts/_partials/list/post-card.html b/layouts/_partials/list/post-card.html new file mode 100644 index 0000000..6444701 --- /dev/null +++ b/layouts/_partials/list/post-card.html @@ -0,0 +1,66 @@ +{{- /* +Card with a summary of and link to a post. Accepts a dict with the following parameters: + +@context {Page} post: The post to display. +@context {bool} show_section: Whether to display a badge with the name of the section the post was published under (default: false). + +@example: {{ partial "list/post-card.html" (dict "post" . "show_section" true) }} +*/ -}} + +{{- $post := .post -}} +{{- $showSection := .show_section | default false -}} +
+
+

+ + {{ $post.Title }} + +

+
+ + + {{- if $showSection }} + + {{ lang.Translate ($post.Section | singularize) | default ($post.Section | singularize | title) }} + + {{- end }} +
+
+ + {{- with $post.Summary }} +
+ {{ . }} +
+ {{- end }} + + {{- with $post.Params.tags }} +
+
    + {{- range first 3 . }} +
  • + #{{ . }} +
  • + {{- end }} + {{- if gt (len .) 3 }} +
  • + + +{{ sub (len .) 3 }} {{ lang.Translate "more" | default "more" }} + +
  • + {{- end }} +
+
+ {{- end }} +
diff --git a/layouts/_partials/list/recent-posts.html b/layouts/_partials/list/recent-posts.html new file mode 100644 index 0000000..464e9f7 --- /dev/null +++ b/layouts/_partials/list/recent-posts.html @@ -0,0 +1,45 @@ +{{- /* +List of specified number of the most recent and published 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 -}} +
+
+

+ {{ $title }} +

+
+ + {{- $recentPosts := where site.RegularPages "Params.excludeFromLists" "!=" true | first $count }} + {{- if $recentPosts }} +
+
    + {{- range $recentPosts }} +
  • + {{- partial "list/post-card.html" (dict "post" . "show_section" true) }} +
  • + {{- end }} +
+ + {{- if $showViewAll }} + {{- with site.GetPage "/all-posts"}} + + {{ lang.Translate "posts_all_view" | default "View all posts" }} » + + {{- end }} + {{- end }} +
+ {{ else }} +

+ {{ lang.Translate "list_empty" | default "No posts in this section." }} +

+ {{- end }} +
diff --git a/layouts/_partials/navmenu.html b/layouts/_partials/navmenu.html new file mode 100644 index 0000000..af0fc2e --- /dev/null +++ b/layouts/_partials/navmenu.html @@ -0,0 +1,48 @@ +{{- /* +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. + +@example: {{ partial "navmenu.html" (dict "menuID" "main" "page" .) }} +*/}} + +{{- $currentPage := .page }} +{{- $menuID := .menuID }} + +{{- with index site.Menus $menuID }} + +{{- end -}} diff --git a/layouts/_partials/select-language.html b/layouts/_partials/select-language.html new file mode 100644 index 0000000..6efcc61 --- /dev/null +++ b/layouts/_partials/select-language.html @@ -0,0 +1,38 @@ +{{- /* +Selection of available languages. +Dynamically links to corresponding page/post if a translated version exists, otherwise to homepage of that language as fallback. + +Note: `$activeLang` and `$allTranslationsForPage` are technically unnecessary variables, their values could be called with `$.Lang` and `$.Translations` respectively. +These variables - together with the explicit naming of `.` context variables in other cases - were chosen for better readability and understandability of the code. +*/ -}} + +{{- if gt (len site.Languages) 1 }} +{{- $activeLang := .Lang }} +{{- $allTranslationsForPage := .Translations }} +
+ +
+{{- end }} diff --git a/layouts/_partials/select-theme.html b/layouts/_partials/select-theme.html new file mode 100644 index 0000000..914eacc --- /dev/null +++ b/layouts/_partials/select-theme.html @@ -0,0 +1,15 @@ + diff --git a/layouts/_partials/single/next-prev.html b/layouts/_partials/single/next-prev.html new file mode 100644 index 0000000..932fcac --- /dev/null +++ b/layouts/_partials/single/next-prev.html @@ -0,0 +1,44 @@ +{{- /* Navigation for next & previous post and back to top */ -}} +{{- if ne .Params.excludeFromLists true }} + + + + + +{{- end }} diff --git a/layouts/_partials/single/tags.html b/layouts/_partials/single/tags.html new file mode 100644 index 0000000..0c10d20 --- /dev/null +++ b/layouts/_partials/single/tags.html @@ -0,0 +1,17 @@ +{{- with .GetTerms "tags" }} +
+ + + +
+{{- end }} diff --git a/layouts/all-posts.html b/layouts/all-posts.html new file mode 100644 index 0000000..4a94ab6 --- /dev/null +++ b/layouts/all-posts.html @@ -0,0 +1,36 @@ +{{ define "main" }} +
+
+

+ {{ .Title }} +

+ {{- with .Content }} +
+ {{ . }} +
+ {{- else }} + {{- $description := or .Description (lang.Translate "posts_all_description" | default "All posts on this website, from newest to oldest.") }} +

+ {{ $description }} +

+ {{- end }} +
+ + {{ $allPosts := where site.RegularPages "Params.excludeFromLists" "!=" true }} + {{- if $allPosts }} +
+
    + {{- range $allPosts.ByDate.Reverse }} +
  • + {{ partial "list/post-card.html" (dict "post" . "show_section" true) }} +
  • + {{- end }} +
+
+ {{ else }} +

+ {{ lang.Translate "posts_empty" | default "This site does not have any posts yet." }} +

+ {{- end }} +
+{{ end }} diff --git a/layouts/baseof.html b/layouts/baseof.html new file mode 100644 index 0000000..99f09d9 --- /dev/null +++ b/layouts/baseof.html @@ -0,0 +1,53 @@ + + + + + + {{ block "title" . }}{{ if and (not .IsHome) .Title }}{{ .Title }} | {{ end }}{{ site.Title }}{{ end }} + + {{- with .Description }} + + {{- else }} + {{- if or .IsPage .IsSection}} + + {{- else }} + + {{- end }} + {{- end }} + + + + + {{- if .IsTranslated }} + {{- range .Translations }} + + {{- end }} + {{- end }} + + {{- with .OutputFormats.Get "rss" }} + {{- printf `` .Rel .MediaType.Type .Permalink site.Title | safeHTML }} + {{- end }} + + {{- partial "head/meta.html" . }} + {{- partial "head/seo.html" . }} + + + {{- partialCached "head/css.html" . }} + {{ partialCached "head/js.html" . }} + + + + {{ partial "header.html" . }} + {{ partial "navmenu.html" (dict "menuID" "main" "page" .) }} + +
+ {{ block "main" . }}{{ end }} +
+ + {{ partial "footer.html" . }} + + diff --git a/layouts/home.html b/layouts/home.html new file mode 100644 index 0000000..880f124 --- /dev/null +++ b/layouts/home.html @@ -0,0 +1,24 @@ +{{- define "main" }} +
+
+

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

+ {{- with site.Params.author.portrait }} + {{ . }} + {{- end }} + {{- with .Content }} +
+ {{ . }} +
+ {{- end }} +
+ + {{- partial "list/recent-posts.html" (dict + "count" 5 + "title" (lang.Translate "posts_recent" | default "Recent Articles") + "show_view_all" true + ) + -}} +
+{{- end }} diff --git a/layouts/list.html b/layouts/list.html new file mode 100644 index 0000000..f952e56 --- /dev/null +++ b/layouts/list.html @@ -0,0 +1,39 @@ +{{- define "main" }} +
+
+

+ {{ .Title }} +

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

+ {{ $description }} +

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

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

+ {{- end }} +
+ + {{- partial "list/pagination.html" $paginator }} +
+{{- end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html deleted file mode 100644 index a0a30b2..0000000 --- a/layouts/partials/footer.html +++ /dev/null @@ -1,41 +0,0 @@ - diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html deleted file mode 100644 index d4e894e..0000000 --- a/layouts/partials/head/css.html +++ /dev/null @@ -1,21 +0,0 @@ -{{- with resources.Get "css/main.css" -}} - {{- $allStylesheets := slice - . - (resources.Get "css/header.css") - (resources.Get "css/navmenu.css") - (resources.Get "css/footer.css") - (resources.Get "css/post-card.css") - (resources.Get "css/page.css") - (resources.Get "css/post.css") - (resources.Get "css/list-navigation.css") - (resources.Get "css/search.css") - -}} - {{- $cssBundle := $allStylesheets | resources.Concat "css/bundle.css" -}} - - {{- if hugo.IsDevelopment -}} - - {{- else -}} - {{- $css := $cssBundle | minify | fingerprint -}} - - {{- end -}} -{{- end -}} diff --git a/layouts/partials/head/js.html b/layouts/partials/head/js.html deleted file mode 100644 index 0baf831..0000000 --- a/layouts/partials/head/js.html +++ /dev/null @@ -1,16 +0,0 @@ -{{- with resources.Get "js/main.js" }} - {{- $opts := dict - "minify" (not hugo.IsDevelopment) - "sourceMap" (cond hugo.IsDevelopment "external" "") - "targetPath" "js/main.js" - }} - {{- with . | js.Build $opts }} - {{- if hugo.IsDevelopment }} - - {{- else }} - {{- with . | fingerprint }} - - {{- end }} - {{- end }} - {{- end }} -{{- end -}} diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html deleted file mode 100644 index f739838..0000000 --- a/layouts/partials/head/meta.html +++ /dev/null @@ -1,27 +0,0 @@ -{{- /* Basic Meta */ -}} - - - -{{- /* Open Graph */ -}} - - - - - -{{- with site.Params.logo }} - -{{- end }} -{{- if .IsPage }} - - {{- with .Lastmod }} - - {{- end }} -{{- end }} - -{{- /* Twitter Card */ -}} - - - -{{- with site.Params.logo }} - -{{- end }} diff --git a/layouts/partials/head/seo.html b/layouts/partials/head/seo.html deleted file mode 100644 index 628ea2c..0000000 --- a/layouts/partials/head/seo.html +++ /dev/null @@ -1,46 +0,0 @@ - diff --git a/layouts/partials/header.html b/layouts/partials/header.html deleted file mode 100644 index f38b6f2..0000000 --- a/layouts/partials/header.html +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/layouts/partials/list/pagination.html b/layouts/partials/list/pagination.html deleted file mode 100644 index dfe8178..0000000 --- a/layouts/partials/list/pagination.html +++ /dev/null @@ -1,28 +0,0 @@ -{{- $paginator := . }} -{{- if gt $paginator.TotalPages 1 }} - -{{- end }} diff --git a/layouts/partials/list/post-card.html b/layouts/partials/list/post-card.html deleted file mode 100644 index 6444701..0000000 --- a/layouts/partials/list/post-card.html +++ /dev/null @@ -1,66 +0,0 @@ -{{- /* -Card with a summary of and link to a post. Accepts a dict with the following parameters: - -@context {Page} post: The post to display. -@context {bool} show_section: Whether to display a badge with the name of the section the post was published under (default: false). - -@example: {{ partial "list/post-card.html" (dict "post" . "show_section" true) }} -*/ -}} - -{{- $post := .post -}} -{{- $showSection := .show_section | default false -}} -
-
-

- - {{ $post.Title }} - -

-
- - - {{- if $showSection }} - - {{ lang.Translate ($post.Section | singularize) | default ($post.Section | singularize | title) }} - - {{- end }} -
-
- - {{- with $post.Summary }} -
- {{ . }} -
- {{- end }} - - {{- with $post.Params.tags }} -
-
    - {{- range first 3 . }} -
  • - #{{ . }} -
  • - {{- end }} - {{- if gt (len .) 3 }} -
  • - - +{{ sub (len .) 3 }} {{ lang.Translate "more" | default "more" }} - -
  • - {{- end }} -
-
- {{- end }} -
diff --git a/layouts/partials/list/recent-posts.html b/layouts/partials/list/recent-posts.html deleted file mode 100644 index 464e9f7..0000000 --- a/layouts/partials/list/recent-posts.html +++ /dev/null @@ -1,45 +0,0 @@ -{{- /* -List of specified number of the most recent and published 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 -}} -
-
-

- {{ $title }} -

-
- - {{- $recentPosts := where site.RegularPages "Params.excludeFromLists" "!=" true | first $count }} - {{- if $recentPosts }} -
-
    - {{- range $recentPosts }} -
  • - {{- partial "list/post-card.html" (dict "post" . "show_section" true) }} -
  • - {{- end }} -
- - {{- if $showViewAll }} - {{- with site.GetPage "/all-posts"}} - - {{ lang.Translate "posts_all_view" | default "View all posts" }} » - - {{- end }} - {{- end }} -
- {{ else }} -

- {{ lang.Translate "list_empty" | default "No posts in this section." }} -

- {{- end }} -
diff --git a/layouts/partials/navmenu.html b/layouts/partials/navmenu.html deleted file mode 100644 index af0fc2e..0000000 --- a/layouts/partials/navmenu.html +++ /dev/null @@ -1,48 +0,0 @@ -{{- /* -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. - -@example: {{ partial "navmenu.html" (dict "menuID" "main" "page" .) }} -*/}} - -{{- $currentPage := .page }} -{{- $menuID := .menuID }} - -{{- with index site.Menus $menuID }} - -{{- end -}} diff --git a/layouts/partials/select-language.html b/layouts/partials/select-language.html deleted file mode 100644 index 6efcc61..0000000 --- a/layouts/partials/select-language.html +++ /dev/null @@ -1,38 +0,0 @@ -{{- /* -Selection of available languages. -Dynamically links to corresponding page/post if a translated version exists, otherwise to homepage of that language as fallback. - -Note: `$activeLang` and `$allTranslationsForPage` are technically unnecessary variables, their values could be called with `$.Lang` and `$.Translations` respectively. -These variables - together with the explicit naming of `.` context variables in other cases - were chosen for better readability and understandability of the code. -*/ -}} - -{{- if gt (len site.Languages) 1 }} -{{- $activeLang := .Lang }} -{{- $allTranslationsForPage := .Translations }} -
- -
-{{- end }} diff --git a/layouts/partials/select-theme.html b/layouts/partials/select-theme.html deleted file mode 100644 index 914eacc..0000000 --- a/layouts/partials/select-theme.html +++ /dev/null @@ -1,15 +0,0 @@ - diff --git a/layouts/partials/single/next-prev.html b/layouts/partials/single/next-prev.html deleted file mode 100644 index 55a3fff..0000000 --- a/layouts/partials/single/next-prev.html +++ /dev/null @@ -1,44 +0,0 @@ -{{- /* Navigation for next & previous post and back to top */ -}} -{{- if ne .Params.excludeFromLists true }} - - - - - -{{- end }} diff --git a/layouts/partials/single/tags.html b/layouts/partials/single/tags.html deleted file mode 100644 index 0c10d20..0000000 --- a/layouts/partials/single/tags.html +++ /dev/null @@ -1,17 +0,0 @@ -{{- with .GetTerms "tags" }} -
- - - -
-{{- end }} diff --git a/layouts/search.html b/layouts/search.html new file mode 100644 index 0000000..6004f2e --- /dev/null +++ b/layouts/search.html @@ -0,0 +1,70 @@ +{{ define "main" }} +
+
+

+ {{ .Title }} +

+ {{- with .Content }} +
+ {{ . }} +
+ {{- else }} + {{- $description := or .Description (lang.Translate "search_description" | default "Find posts by search term.") }} +

+ {{ $description }} +

+ {{- end }} +
+ +
+ + +
+ +
+ + + + + {{- /* Hidden template, used for hydrating search results from index.json with JS */ -}} + + +
+
+{{ end }} diff --git a/layouts/single.html b/layouts/single.html new file mode 100644 index 0000000..e1728d3 --- /dev/null +++ b/layouts/single.html @@ -0,0 +1,23 @@ +{{- define "main" }} +
+
+

+ {{ .Title }} +

+ {{- with .Date }} + + {{- end }} +
+ +
+ {{ .Content }} +
+ + +
+{{- end }} -- cgit v1.2.3