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