diff --git a/assets/css/compiled/main.css b/assets/css/compiled/main.css index 8f462959..402e86f1 100644 --- a/assets/css/compiled/main.css +++ b/assets/css/compiled/main.css @@ -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; } diff --git a/layouts/partials/article-link/_shortcode.html b/layouts/partials/article-link/_shortcode.html index 79756146..db73ec3c 100644 --- a/layouts/partials/article-link/_shortcode.html +++ b/layouts/partials/article-link/_shortcode.html @@ -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 }}
-
+
{{ $target.Summary | plainify }}
diff --git a/layouts/shortcodes/article.html b/layouts/shortcodes/article.html index f71181b6..299319ff 100644 --- a/layouts/shortcodes/article.html +++ b/layouts/shortcodes/article.html @@ -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 }}
- {{ $context := dict "target" $target "showSummary" $showSummary }} + {{ $context := dict "target" $target "showSummary" $showSummary "compactSummary" $compactSummary }} {{ partial "article-link/_shortcode.html" $context }}
{{ end }}