From 32c1a5dd203435e8bef324306d1516e28ce14615 Mon Sep 17 00:00:00 2001 From: Arne Rief Date: Sat, 20 Dec 2025 20:03:23 +0100 Subject: Post-Card new design, improved styling for codeblocks & search --- layouts/_default/all-posts.html | 2 +- layouts/_default/list.html | 2 +- layouts/_default/search.html | 3 ++- layouts/index.json | 1 + layouts/partials/list/post-card.html | 23 +++++++++++++++++++---- layouts/partials/list/recent-posts.html | 2 +- layouts/tags/term.html | 2 +- 7 files changed, 26 insertions(+), 9 deletions(-) (limited to 'layouts') diff --git a/layouts/_default/all-posts.html b/layouts/_default/all-posts.html index d2ce8ee..dcfe74e 100644 --- a/layouts/_default/all-posts.html +++ b/layouts/_default/all-posts.html @@ -22,7 +22,7 @@ diff --git a/layouts/_default/list.html b/layouts/_default/list.html index fb53b40..f952e56 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -23,7 +23,7 @@ diff --git a/layouts/_default/search.html b/layouts/_default/search.html index 90a6357..b501c8b 100644 --- a/layouts/_default/search.html +++ b/layouts/_default/search.html @@ -55,12 +55,13 @@ {{- $mockPost := dict "Title" "TEMPLATE_TITLE" "RelPermalink" "TEMPLATE_URL" + "Section" "TEMPLATE_SECTION" "Date" now "Summary" "TEMPLATE_SUMMARY" "Params" (dict "tags" (slice "TEMPLATE_TAG")) -}}
  • - {{- partial "list/post-card.html" $mockPost }} + {{- partial "list/post-card.html" (dict "post" $mockPost "show_category" true) }}
  • diff --git a/layouts/index.json b/layouts/index.json index 29d7e14..00a7048 100644 --- a/layouts/index.json +++ b/layouts/index.json @@ -5,6 +5,7 @@ "title" .Title "summary" (.Summary | plainify | htmlUnescape) "url" .RelPermalink + "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/list/post-card.html b/layouts/partials/list/post-card.html index 955e868..b35c724 100644 --- a/layouts/partials/list/post-card.html +++ b/layouts/partials/list/post-card.html @@ -1,4 +1,14 @@ -{{- $post := . }} +{{- /* +Card with a summary of and link to a post. Accepts a dict with the following optional 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). + +@example: {{ partial "list/post-card.html" (dict "post" . "show_category" true) }} +*/ -}} + +{{- $post := .post }} +{{- $showCategory := .show_category | default false }}

    @@ -13,14 +23,20 @@ + {{- if $showCategory }} + {{- $section := $post.Section }} + + {{ lang.Translate ($section | singularize) | default ($section | singularize | title) }} + + {{- end }}

    @@ -47,6 +63,5 @@ {{- end }} -
    {{- end }}
    diff --git a/layouts/partials/list/recent-posts.html b/layouts/partials/list/recent-posts.html index 5426f70..f42af13 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 diff --git a/layouts/tags/term.html b/layouts/tags/term.html index cb7d1b0..8a259c2 100644 --- a/layouts/tags/term.html +++ b/layouts/tags/term.html @@ -20,7 +20,7 @@ -- cgit v1.2.3