Files
HugoBlox-kit/layouts/partials/portfolio_li_card.html
T
George Cushen 58c8bc4609 feat: add options to customise length of listing summaries
When `summary` is defined, the full summary text is now shown in listings.

Add `summaryLength = 30` (length in words) to `config.toml` to customise automatic summaries from using `<!--more-->` tag or full content (when `summary` and `abstract` are not defined).

Add `abstract_length = 135` (length in characters) to `params.toml` to customise truncation when `abstract` is used as the summary.

Close #1374
2020-03-06 21:05:17 +00:00

38 lines
1.3 KiB
HTML

{{ $item := .item }}
{{ $widget := .widget }}
{{ $link := .link }}
{{ $target := .target }}
{{/* Get summary. */}}
{{ $summary := "" }}
{{ if $item.Params.summary }}
{{ $summary = $item.Params.summary | markdownify | emojify }}
{{ else if .Params.abstract }}
{{ $summary = .Params.abstract | markdownify | emojify | truncate (site.Params.abstract_length | default 135) }}
{{ else if $item.Summary }}
{{ $summary = $item.Summary }}
{{ end }}
{{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }}
<div class="project-card project-item isotope-item {{ $js_tag_classes | safeHTMLAttr }}">
<div class="card">
{{ with $resource }}
{{ $image := .Resize (printf "550x q90 %s") }}
<a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="card-image hover-overlay">
<img src="{{ $image.RelPermalink }}" alt="" class="img-responsive">
</a>
{{ end }}
<div class="card-text">
<h4><a href="{{ $link }}" {{ $target | safeHTMLAttr }}>{{ $item.Title | markdownify | emojify }}</a></h4>
{{ with $summary }}
<div class="article-style">
<p>{{ . }}</p>
</div>
{{ end }}
</div>
</div>
</div>