diff options
| author | Arne Rief <riearn@proton.me> | 2025-12-22 14:02:07 +0100 |
|---|---|---|
| committer | Arne Rief <riearn@proton.me> | 2025-12-22 14:02:07 +0100 |
| commit | 038054b8206a9c25e84adeb0f0f355abd22d6143 (patch) | |
| tree | 47700e52b88e0db08f0ca113de22f4c0d05cc405 /layouts | |
| parent | 32c1a5dd203435e8bef324306d1516e28ce14615 (diff) | |
CSS & JS splitting, small fix section badge
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_default/all-posts.html | 2 | ||||
| -rw-r--r-- | layouts/_default/search.html | 2 | ||||
| -rw-r--r-- | layouts/index.json | 2 | ||||
| -rw-r--r-- | layouts/partials/head/css.html | 28 | ||||
| -rw-r--r-- | layouts/partials/list/post-card.html | 17 | ||||
| -rw-r--r-- | layouts/partials/list/recent-posts.html | 2 | ||||
| -rw-r--r-- | layouts/tags/term.html | 2 |
7 files changed, 33 insertions, 22 deletions
diff --git a/layouts/_default/all-posts.html b/layouts/_default/all-posts.html index dcfe74e..4a94ab6 100644 --- a/layouts/_default/all-posts.html +++ b/layouts/_default/all-posts.html @@ -22,7 +22,7 @@ <ul class="all-posts__list" role="list"> {{- range $allPosts.ByDate.Reverse }} <li class="all-posts__list-item"> - {{ partial "list/post-card.html" (dict "post" . "show_category" true) }} + {{ partial "list/post-card.html" (dict "post" . "show_section" true) }} </li> {{- end }} </ul> diff --git a/layouts/_default/search.html b/layouts/_default/search.html index b501c8b..6004f2e 100644 --- a/layouts/_default/search.html +++ b/layouts/_default/search.html @@ -61,7 +61,7 @@ "Params" (dict "tags" (slice "TEMPLATE_TAG")) -}} <li class="search-results__list-item"> - {{- partial "list/post-card.html" (dict "post" $mockPost "show_category" true) }} + {{- partial "list/post-card.html" (dict "post" $mockPost "show_section" true) }} </li> </template> diff --git a/layouts/index.json b/layouts/index.json index 00a7048..e50a721 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -5,7 +5,7 @@ "title" .Title "summary" (.Summary | plainify | htmlUnescape) "url" .RelPermalink - "section" (lang.translate (.Section | singularize) | default (.Section | singularize | title)) + "section" (lang.Translate (.Section | singularize) | default (.Section | singularize | title)) "date" (.Date.Format "2006-01-02T15:04:05Z07:00") "tags" .Params.tags -}} diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html index c3c6e33..d4e894e 100644 --- a/layouts/partials/head/css.html +++ b/layouts/partials/head/css.html @@ -1,9 +1,21 @@ -{{- with resources.Get "css/main.css" }} - {{- if hugo.IsDevelopment }} - <link rel="stylesheet" href="{{ .RelPermalink }}"> - {{- else }} - {{- with . | minify | fingerprint }} - <link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"> - {{- end }} - {{- end }} +{{- 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 -}} + <link rel="stylesheet" href="{{ $cssBundle.RelPermalink }}"> + {{- else -}} + {{- $css := $cssBundle | minify | fingerprint -}} + <link rel="stylesheet" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous"> + {{- end -}} {{- end -}} diff --git a/layouts/partials/list/post-card.html b/layouts/partials/list/post-card.html index b35c724..6444701 100644 --- a/layouts/partials/list/post-card.html +++ b/layouts/partials/list/post-card.html @@ -1,14 +1,14 @@ {{- /* -Card with a summary of and link to a post. Accepts a dict with the following optional parameters: +Card with a summary of and link to a post. Accepts a dict with the following parameters: -@context {Page} post: The post to display (default: .). -@context {bool} show_category: Whether to display a badge with the name of the category/section the post was published under (default: true). +@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_category" true) }} +@example: {{ partial "list/post-card.html" (dict "post" . "show_section" true) }} */ -}} -{{- $post := .post }} -{{- $showCategory := .show_category | default false }} +{{- $post := .post -}} +{{- $showSection := .show_section | default false -}} <article class="post-card"> <header class="post-card__header"> <h3 class="post-card__title"> @@ -31,10 +31,9 @@ Card with a summary of and link to a post. Accepts a dict with the following opt </span> </p> --> - {{- if $showCategory }} - {{- $section := $post.Section }} + {{- if $showSection }} <span class="post-card__section-badge"> - {{ lang.Translate ($section | singularize) | default ($section | singularize | title) }} + {{ lang.Translate ($post.Section | singularize) | default ($post.Section | singularize | title) }} </span> {{- end }} </div> diff --git a/layouts/partials/list/recent-posts.html b/layouts/partials/list/recent-posts.html index f42af13..464e9f7 100644 --- a/layouts/partials/list/recent-posts.html +++ b/layouts/partials/list/recent-posts.html @@ -24,7 +24,7 @@ List of specified number of the most recent and published posts. Accepts a dict <ul class="recent-posts__list" role="list"> {{- range $recentPosts }} <li class="recent-posts__list-item"> - {{- partial "list/post-card.html" (dict "post" . "show_category" true) }} + {{- partial "list/post-card.html" (dict "post" . "show_section" true) }} </li> {{- end }} </ul> diff --git a/layouts/tags/term.html b/layouts/tags/term.html index 8a259c2..f4dfd73 100644 --- a/layouts/tags/term.html +++ b/layouts/tags/term.html @@ -20,7 +20,7 @@ <ul class="tag-page__posts-list"> {{- range . }} <li class="tag-page__post"> - {{- partial "list/post-card.html" (dict "post" . "show_category" true) }} + {{- partial "list/post-card.html" (dict "post" . "show_section" true) }} </li> {{- end }} </ul> |
