Skip to content

Commit

Permalink
style: show the ... indicates that the summaries were truncated (#374)
Browse files Browse the repository at this point in the history
  • Loading branch information
TetraTheta authored and razonyang committed Oct 5, 2023
1 parent 740d847 commit 48bf0e6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 5 additions & 0 deletions assets/hb/modules/blog/scss/post/_summary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@
margin-bottom: 0;
}
}
.summary-truncated {
&::after {
content: "";
}
}
14 changes: 10 additions & 4 deletions layouts/partials/hb/modules/blog/post/card.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $page := .Page }}
{{- $summary := default true .Summary }}
{{- $showSummary := default true .Summary }}
{{- $readingTime := default true .ReadingTime }}
{{- $meta := default true .Meta }}
<div class="hb-blog-post-card card border-0 overflow-hidden">
Expand Down Expand Up @@ -30,9 +30,15 @@
{{ partialCached "hb/modules/blog/post/meta/taxonomies" $page $page }}
</div>
{{- end }}
{{- if $summary }}
<div class="hb-blog-post-summary card-text text-secondary">
{{- default $page.Summary $page.Description -}}
{{- if $showSummary }}
{{- $summary := $page.Summary }}
{{- $truncated := $page.Truncated }}
{{- with $page.Description }}
{{- $summary = . }}
{{- $truncated = false }}
{{- end }}
<div class="hb-blog-post-summary card-text text-secondary{{ cond $truncated ` summary-truncated` `` }}">
{{- $summary -}}
</div>
{{- end }}
</div>
Expand Down

0 comments on commit 48bf0e6

Please sign in to comment.