diff options
Diffstat (limited to 'layouts/partials/list/post-card.html')
| -rw-r--r-- | layouts/partials/list/post-card.html | 23 |
1 files changed, 19 insertions, 4 deletions
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 }} <article class="post-card"> <header class="post-card__header"> <h3 class="post-card__title"> @@ -13,14 +23,20 @@ <!-- Uncomment for post meta info <p class="post-card__meta-info"> <span class="post-card__reading-time"> - {{ lang.Translate "reading_time" $post.ReadingTime | default (printf "Estimated reading time: %s min" $post.ReadingTime) }} + • {{ lang.Translate "reading_time" $post.ReadingTime | default (printf "Estimated reading time: %s min" $post.ReadingTime) }} </span> | <span class="post-card__word-count"> - {{ lang.Translate "word_count" $post.WordCount | default (printf "%s words" $post.WordCount) }} + {{ lang.Translate "word_count" $post.WordCount | default (printf "%s words" $post.WordCount) }} • </span> </p> --> + {{- if $showCategory }} + {{- $section := $post.Section }} + <span class="post-card__section-badge"> + {{ lang.Translate ($section | singularize) | default ($section | singularize | title) }} + </span> + {{- end }} </div> </header> @@ -47,6 +63,5 @@ {{- end }} </ul> </footer> - <hr /> {{- end }} </article> |
