mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-12 20:15:25 +00:00
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
This commit is contained in:
1 parent
63918091fb
commit
58c8bc4609
6 files changed
+12
-14
No files matched your search
@@ -31,6 +31,7 @@ hasCJKLanguage = false # Set `true` for Chinese/Japanese/Korean languages.
|
||||
defaultContentLanguageInSubdir = false
|
||||
removePathAccents = true # Workaround for https://github.com/gohugoio/hugo/issues/5687
|
||||
|
||||
summaryLength = 30 # Listing summary length in words. Also, see `abstract_length` in `params.toml`.
|
||||
paginate = 10 # Number of items per page in paginated lists.
|
||||
enableEmoji = true
|
||||
footnotereturnlinkcontents = "<sup>^</sup>"
|
||||
|
||||
@@ -155,6 +155,9 @@ sharing = true
|
||||
# Link authors to their profile page? (true/false)
|
||||
link_authors = true
|
||||
|
||||
# Abstract length (characters) in the Compact and Portfolio Card list views. Also, see `summaryLength` in `config.toml`.
|
||||
abstract_length = 135
|
||||
|
||||
# Load JS plugins
|
||||
# E.g. To load `/assets/js/custom.js`, set `plugins_js = ["custom"]`.
|
||||
plugins_js = []
|
||||
|
||||
@@ -15,10 +15,8 @@
|
||||
{{ $summary = $item.Params.summary | markdownify | emojify }}
|
||||
{{ else if .Params.abstract }}
|
||||
{{ $summary = .Params.abstract | markdownify | emojify }}
|
||||
{{ else if $item.Truncated }}
|
||||
{{ else if $item.Summary }}
|
||||
{{ $summary = $item.Summary }}
|
||||
{{ else }}
|
||||
{{ $summary = $item.Content }}
|
||||
{{ end }}
|
||||
|
||||
<div class="card-simple">
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
{{ if $item.Params.summary }}
|
||||
{{ $summary = $item.Params.summary | markdownify | emojify }}
|
||||
{{ else if .Params.abstract }}
|
||||
{{ $summary = .Params.abstract | markdownify | emojify }}
|
||||
{{ else if $item.Truncated }}
|
||||
{{ $summary = .Params.abstract | markdownify | emojify | truncate (site.Params.abstract_length | default 135) }}
|
||||
{{ else if $item.Summary }}
|
||||
{{ $summary = $item.Summary }}
|
||||
{{ end }}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
{{ with $summary }}
|
||||
<div class="article-style">
|
||||
{{ . | truncate 135 }}
|
||||
{{ . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
{{ if $item.Params.summary }}
|
||||
{{ $summary = $item.Params.summary | markdownify | emojify }}
|
||||
{{ else if .Params.abstract }}
|
||||
{{ $summary = .Params.abstract | markdownify | emojify }}
|
||||
{{ else if $item.Truncated }}
|
||||
{{ $summary = .Params.abstract | markdownify | emojify | truncate (site.Params.abstract_length | default 135) }}
|
||||
{{ else if $item.Summary }}
|
||||
{{ $summary = $item.Summary }}
|
||||
{{ else }}
|
||||
{{ $summary = $item.Content }}
|
||||
{{ end }}
|
||||
|
||||
{{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
|
||||
@@ -31,7 +29,7 @@
|
||||
<h4><a href="{{ $link }}" {{ $target | safeHTMLAttr }}>{{ $item.Title | markdownify | emojify }}</a></h4>
|
||||
{{ with $summary }}
|
||||
<div class="article-style">
|
||||
<p>{{ . | truncate 135 }}</p>
|
||||
<p>{{ . }}</p>
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
@@ -17,10 +17,8 @@
|
||||
{{ $summary = $item.Params.summary | markdownify | emojify }}
|
||||
{{ else if .Params.abstract }}
|
||||
{{ $summary = .Params.abstract | markdownify | emojify }}
|
||||
{{ else if $item.Truncated }}
|
||||
{{ else if $item.Summary }}
|
||||
{{ $summary = $item.Summary }}
|
||||
{{ else }}
|
||||
{{ $summary = $item.Content }}
|
||||
{{ end }}
|
||||
|
||||
{{ $order := "" }}
|
||||
|
||||
Reference in new issue
Block a user