Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wlh320/hugo-theme-hulga.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzilcH40 <wlh233@live.com>2022-09-12 07:50:38 +0300
committerzilcH40 <wlh233@live.com>2022-09-12 07:50:38 +0300
commitf1ca3b22fd272b097eca2b7e5466d25126f1ee7a (patch)
tree24c035cdd5139a4bcb521605127cf089886119ef
parentf944fea8ba84a0aee2f91fcc5944faa9d7b88436 (diff)
feat #5: add option to show summary of post
-rw-r--r--assets/css/common.scss5
-rw-r--r--layouts/partials/posts.html24
2 files changed, 22 insertions, 7 deletions
diff --git a/assets/css/common.scss b/assets/css/common.scss
index 3b826b1..1eec40e 100644
--- a/assets/css/common.scss
+++ b/assets/css/common.scss
@@ -115,6 +115,7 @@ body {
}
.post-box-title {
margin-right: 1.25rem;
+ margin-bottom: 0.5rem;
width: 100%;
}
.post-box-tags {
@@ -130,6 +131,10 @@ body {
margin-right: 1.25rem;
width: 100%;
}
+.post-box-summary {
+ margin-right: 1.25rem;
+ opacity: 0.9;
+}
.post-box-meta:last-child {
padding-bottom: 1.25rem;
}
diff --git a/layouts/partials/posts.html b/layouts/partials/posts.html
index f8d1810..dfbdeb3 100644
--- a/layouts/partials/posts.html
+++ b/layouts/partials/posts.html
@@ -12,17 +12,27 @@
<div class="post-box-title">
<a href="{{ .Permalink }}" class="title is-size-5">{{ .Title }}</a>
</div>
+ {{ if .Site.Params.showSummary }}
+ <div class="post-box-summary">
+ {{ .Summary }}
+ {{ if .Truncated }}
+ <span>
+ <a href="{{ .RelPermalink }}">…Read More</a>
+ </span>
+ {{ end }}
+ </div>
+ {{ end }}
<div class="post-box-meta">
{{ .Date.Format "2006/01/02" }}
{{ with .Params.Categories }} ・
- {{ range .}}
- <span class="post-tag post-box-category">
- <a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}/">{{ . }}</a>
- </span>
- {{ end }}
+ {{ range .}}
+ <span class="post-tag post-box-category">
+ <a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}/">{{ . }}</a>
+ </span>
+ {{ end }}
{{ end }}
</div>
- {{ with .Params.Tags }}
+ {{ with .Params.Tags }}
<div class="post-box-tags">
{{ range .}}
<span class="post-tag post-box-tag">
@@ -90,4 +100,4 @@
</div>
</div>
</div>
-</section>
+</section> \ No newline at end of file