Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: replace the summaries truncated indicator (dots) with the read more button #388

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>