Skip to content

Commit

Permalink
fix: replace the summaries truncated indicator (dots) with the read m…
Browse files Browse the repository at this point in the history
…ore button (hbstack#388)

Closes hbstack#387
  • Loading branch information
razonyang committed Oct 9, 2023
1 parent ef8c026 commit 7cc02cc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
6 changes: 0 additions & 6 deletions assets/hb/modules/blog/scss/post/_summary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,3 @@
margin-bottom: 0;
}
}

.summary-truncated {
&::after {
content: "";
}
}
3 changes: 3 additions & 0 deletions i18n/en.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[on_this_page]
other = "On this page"

[read_more]
other = "Read more"

[reading_time]
other = "{{ .Count }} min read"
3 changes: 3 additions & 0 deletions i18n/ko.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[on_this_page]
other = "목차"

[read_more]
other = "Read more"

[reading_time]
other = "읽는 데에 {{ .Count }}분"
3 changes: 3 additions & 0 deletions i18n/zh-hans.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[on_this_page]
other = "本页内容"

[read_more]
other = "阅读全文"

[reading_time]
other = "{{ .Count }} 分钟阅读"
3 changes: 3 additions & 0 deletions i18n/zh-hant.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[on_this_page]
other = "本頁內容"

[read_more]
other = "閱讀全文"

[reading_time]
other = "{{ .Count }} 分鐘閱讀"
14 changes: 11 additions & 3 deletions layouts/partials/hb/modules/blog/post/card.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{{- if default true site.Params.hb.blog.post_thumbnail }}
{{ partial "hb/modules/blog/post/card-img" $page }}
{{- end }}
<div class="card-body px-0 pt-2">
<div class="card-body px-0 pt-2 d-flex flex-column">
<div class="hb-blog-post-title card-title h5 py-1">
<a
class="hb-blog-post-title-link d-block"
Expand All @@ -35,11 +35,19 @@
{{- $truncated := $page.Truncated }}
{{- with $page.Description }}
{{- $summary = . }}
{{- $truncated = false }}
{{- $truncated := true }}
{{- end }}
<div class="hb-blog-post-summary card-text text-secondary{{ cond $truncated ` summary-truncated` `` }}">
<div class="hb-blog-post-summary card-text text-secondary mb-auto">
{{- $summary -}}
</div>
{{- if $truncated }}
<div>
<a
class="btn btn-sm btn-outline-secondary mt-2" href="{{ .RelPermalink }}">
{{- "read_more" | i18n -}}
</a>
</div>
{{- end }}
{{- end }}
</div>
</div>

0 comments on commit 7cc02cc

Please sign in to comment.