mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-06-18 12:03:30 +08:00
feat: add article.readingTime param, and improve style
This commit is contained in:
parent
683f1b4807
commit
85b81e5c81
@ -95,7 +95,9 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
color: var(--card-text-color-tertiary);
|
color: var(--card-text-color-tertiary);
|
||||||
|
gap: 15px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
@ -108,6 +110,11 @@
|
|||||||
time {
|
time {
|
||||||
font-size: 1.4rem;
|
font-size: 1.4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& > div {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-category,
|
.article-category,
|
||||||
|
@ -44,6 +44,7 @@ params:
|
|||||||
article:
|
article:
|
||||||
math: false
|
math: false
|
||||||
toc: true
|
toc: true
|
||||||
|
readingTime: true
|
||||||
license:
|
license:
|
||||||
enabled: true
|
enabled: true
|
||||||
default: Licensed under CC BY-NC-SA 4.0
|
default: Licensed under CC BY-NC-SA 4.0
|
||||||
|
@ -2,10 +2,9 @@
|
|||||||
{{ if .Params.categories }}
|
{{ if .Params.categories }}
|
||||||
<header class="article-category">
|
<header class="article-category">
|
||||||
{{ range (.GetTerms "categories") }}
|
{{ range (.GetTerms "categories") }}
|
||||||
<a href="{{ .RelPermalink }}"
|
<a href="{{ .RelPermalink }}" {{ with .Params.style }}style="background-color: {{ .background }}; color: {{ .color }};"{{ end }}>
|
||||||
{{ with .Params.style }}style="background-color: {{ .background }}; color: {{ .color }};" {{ end }}>
|
{{ .LinkTitle }}
|
||||||
{{ .LinkTitle }}
|
</a>
|
||||||
</a>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</header>
|
</header>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@ -22,16 +21,23 @@
|
|||||||
</h3>
|
</h3>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{- if not .Date.IsZero -}}
|
|
||||||
<footer class="article-time">
|
<footer class="article-time">
|
||||||
{{ partial "helper/icon" "date" }}
|
{{ if not .Date.IsZero }}
|
||||||
<time class="article-time--published">
|
<div>
|
||||||
{{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}} 
|
{{ partial "helper/icon" "date" }}
|
||||||
</time>
|
<time class="article-time--published">
|
||||||
{{ partial "helper/icon" "clock" }}
|
{{- .Date.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
|
||||||
<time class="article-time--published">
|
</time>
|
||||||
{{ .ReadingTime }} min read
|
</div>
|
||||||
</time>
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if .Site.Params.article.readingTime }}
|
||||||
|
<div>
|
||||||
|
{{ partial "helper/icon" "clock" }}
|
||||||
|
<time class="article-time--published">
|
||||||
|
{{ .ReadingTime }} min read
|
||||||
|
</time>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
</footer>
|
</footer>
|
||||||
{{- end -}}
|
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue
Block a user