Files
hugo-theme-stack/layouts/partials/article/components/details.html
T

65 lines
2.2 KiB
HTML
Raw Normal View History

2020-08-29 11:34:26 +02:00
<div class="article-details">
2020-10-09 19:26:28 +02:00
{{ if .Params.categories }}
2020-08-29 11:34:26 +02:00
<header class="article-category">
2020-10-09 19:26:28 +02:00
{{ range (.GetTerms "categories") }}
{{ $color := partial "helper/color-from-str" .LinkTitle }}
{{ $BackgroundColor := default $color.BackgroundColor .Params.style.background }}
{{ $TextColor := default $color.TextColor .Params.style.color }}
<a href="{{ .RelPermalink }}" style="background-color: {{ $BackgroundColor | safeCSS }}; color: {{ $TextColor | safeCSS }};">
{{ .LinkTitle }}
</a>
2020-08-29 11:34:26 +02:00
{{ end }}
</header>
{{ end }}
<div class="article-title-wrapper">
<h2 class="article-title">
<a href="{{ .RelPermalink }}">
{{- .Title -}}
</a>
</h2>
{{ with .Params.description }}
<h3 class="article-subtitle">
{{ . }}
</h3>
{{ end }}
</div>
2020-08-29 11:34:26 +02:00
{{ $showReadingTime := .Params.readingTime | default (.Site.Params.article.readingTime) }}
{{ $showDate := not .Date.IsZero }}
{{ $showFooter := or $showDate $showReadingTime }}
{{ if $showFooter }}
2020-08-29 11:34:26 +02:00
<footer class="article-time">
{{ if $showDate }}
2021-07-23 23:37:30 +07:00
<div>
{{ partial "helper/icon" "date" }}
<time class="article-time--published" datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
{{- .Date | time.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
2021-07-23 23:37:30 +07:00
</time>
</div>
{{ end }}
{{ if $showReadingTime }}
2021-07-23 23:37:30 +07:00
<div>
{{ partial "helper/icon" "clock" }}
<time class="article-time--reading">
{{ T "article.readingTime" .ReadingTime }}
</time>
</div>
{{ end }}
2020-08-29 11:34:26 +02:00
</footer>
2021-07-23 23:37:30 +07:00
{{ end }}
{{ if .IsTranslated }}
<footer class="article-translations">
{{ partial "helper/icon" "language" }}
<div>
{{ range .Translations }}
<a href="{{ .RelPermalink }}" class="link">{{ .Language.LanguageName }}</a>
{{ end }}
</div>
</footer>
{{ end }}
</div>