diff options
Diffstat (limited to 'layouts/partials/list/post-card.html')
| -rw-r--r-- | layouts/partials/list/post-card.html | 17 |
1 files changed, 8 insertions, 9 deletions
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> |
