34 lines
1.1 KiB
Cheetah
34 lines
1.1 KiB
Cheetah
<!--
|
|
Renders related items as an unordered list.
|
|
|
|
@params section_title Title of the sub-section to show (e.g. "Blog Posts").
|
|
@params content Related items.
|
|
-->
|
|
|
|
{{- $section_title := .section_title -}}
|
|
{{- $content := .content -}}
|
|
|
|
<h2 class="subheading">{{ $section_title }} ({{ len $content }})</h2>
|
|
<ul class="related-items related-items--list">
|
|
{{- range $content -}}
|
|
{{- $is_expired := and ( isset .Params "end_date" ) ( lt .Params.end_date ( (time now).Format "2006-01-02" ) ) -}}
|
|
|
|
<li class="related-item{{- if $is_expired }} related-item--expired{{- end -}}">
|
|
<a href="{{- .RelPermalink -}}">
|
|
{{- .Title | safeHTML -}}
|
|
</a>
|
|
|
|
{{- with .Params.grade -}}
|
|
<span class="related-item__grade">
|
|
Grade: {{ . -}}
|
|
</span>
|
|
{{- end -}}
|
|
|
|
{{- with .Params.end_date -}}
|
|
<span class="related-item__expiry">
|
|
<abbr title="expire{{- if $is_expired -}}d{{- else -}}s{{- end -}}">Exp</abbr>: {{ dateFormat "Jan 2 2006" . -}}
|
|
</span>
|
|
{{- end -}}
|
|
</li>
|
|
{{- end -}}
|
|
</ul>
|