mirror of
https://github.com/nunocoracao/blowfish.git
synced 2026-01-30 16:31:52 +01:00
feat: add support for compactSummary option in article shortcode
This commit is contained in:
@@ -1028,6 +1028,12 @@ body.zen-mode-enable {
|
||||
height: 8px;
|
||||
}
|
||||
}
|
||||
.line-clamp-3 {
|
||||
overflow: hidden;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 3;
|
||||
}
|
||||
.\!block {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{{ $target := .target }}
|
||||
{{ $shortcodeShowSummary := .showSummary }}
|
||||
{{ $shortcodeCompactSummary := .compactSummary }}
|
||||
{{ $constrainItemsWidth := site.Params.list.constrainItemsWidth | default false }}
|
||||
{{ $disableImageOptimization := site.Params.disableImageOptimization | default false }}
|
||||
|
||||
@@ -103,8 +104,14 @@
|
||||
{{ $showSummary = $target.Params.showSummary | default (site.Params.list.showSummary | default false) }}
|
||||
{{ end }}
|
||||
{{ if $showSummary }}
|
||||
{{ $compactSummary := false }}
|
||||
{{ if ne $shortcodeCompactSummary nil }}
|
||||
{{ $compactSummary = $shortcodeCompactSummary }}
|
||||
{{ else }}
|
||||
{{ $compactSummary = $target.Params.compactSummary | default (site.Params.list.compactSummary | default false) }}
|
||||
{{ end }}
|
||||
<div class="overflow-hidden pt-1">
|
||||
<div class="prose dark:prose-invert max-w-fit">
|
||||
<div class="{{ if $compactSummary }}line-clamp-3{{ end }} max-w-fit prose dark:prose-invert">
|
||||
{{ $target.Summary | plainify }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
{{ $link := .Get "link" }}
|
||||
{{ $showSummary := .Get "showSummary" }}
|
||||
{{ $compactSummary := .Get "compactSummary" | default false }}
|
||||
{{ $target := .Page }}
|
||||
{{ if ne $link .Page.RelPermalink }}
|
||||
{{ $target = index (first 1 (where .Site.AllPages "RelPermalink" $link)) 0 }}
|
||||
{{ end }}
|
||||
{{ if $target }}
|
||||
<section class="space-y-10 w-full">
|
||||
{{ $context := dict "target" $target "showSummary" $showSummary }}
|
||||
{{ $context := dict "target" $target "showSummary" $showSummary "compactSummary" $compactSummary }}
|
||||
{{ partial "article-link/_shortcode.html" $context }}
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user