refactor: details.html
This commit is contained in:
@@ -3,11 +3,8 @@
|
|||||||
<div class="article-details">
|
<div class="article-details">
|
||||||
{{ if $Page.Params.categories }}
|
{{ if $Page.Params.categories }}
|
||||||
<header class="article-category">
|
<header class="article-category">
|
||||||
{{ range ($Page.GetTerms "categories") }}
|
{{ range (.GetTerms "tags") }}
|
||||||
{{ $color := partial "helper/color-from-str" .LinkTitle }}
|
<a href="{{ .RelPermalink }}" {{ with $Page..Params.style }}style="background-color: {{ .background }}; color: {{ .color }};"{{ end }}>
|
||||||
{{ $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 }}
|
{{ .LinkTitle }}
|
||||||
</a>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
@@ -16,7 +13,7 @@
|
|||||||
|
|
||||||
<div class="article-title-wrapper">
|
<div class="article-title-wrapper">
|
||||||
<h2 class="article-title">
|
<h2 class="article-title">
|
||||||
<a href="{{ $Page.RelPermalink }}">
|
<a href="{{ .RelPermalink }}">
|
||||||
{{- $Page.Title -}}
|
{{- $Page.Title -}}
|
||||||
</a>
|
</a>
|
||||||
</h2>
|
</h2>
|
||||||
@@ -30,97 +27,26 @@
|
|||||||
|
|
||||||
{{ $showReadingTime := $Page.Params.readingTime | default ($Page.Site.Params.article.readingTime) }}
|
{{ $showReadingTime := $Page.Params.readingTime | default ($Page.Site.Params.article.readingTime) }}
|
||||||
{{ $showDate := not $Page.Date.IsZero }}
|
{{ $showDate := not $Page.Date.IsZero }}
|
||||||
{{ $showTime := or $showDate $showReadingTime }}
|
|
||||||
{{ $showTranslations := $Page.IsTranslated }}
|
|
||||||
{{ $showTags := and $Page.Site.Params.Article.List.ShowTags ($Page.GetTerms "tags") $IsList }}
|
|
||||||
|
|
||||||
{{ if or $showTime $showTranslations $showTags }}
|
|
||||||
<footer class="article-meta">
|
|
||||||
{{ if $showTime }}
|
|
||||||
<div class="inline-meta">
|
|
||||||
{{ if $showDate }}
|
|
||||||
{{ partial "helper/icon" "date" }}
|
|
||||||
<time class="article-time--published" datetime='{{ $Page.Date.Format "2006-01-02T15:04:05Z07:00" }}'>
|
|
||||||
{{- $Page.Date | time.Format $Page.Site.Params.dateFormat.published -}}
|
|
||||||
</time>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if $showReadingTime }}
|
|
||||||
{{ partial "helper/icon" "clock" }}
|
|
||||||
<time class="article-time--reading">
|
|
||||||
{{ T "article.readingTime" $Page.ReadingTime }}
|
|
||||||
</time>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if $showTranslations }}
|
|
||||||
<div class="inline-meta">
|
|
||||||
{{ partial "helper/icon" "language" }}
|
|
||||||
{{ range $Page.Translations }}
|
|
||||||
<a href="{{ .RelPermalink }}" class="link">{{ .Language.LanguageName }}</a>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if $showTags }}
|
|
||||||
<div class="article-tags inline-meta">
|
|
||||||
{{ partial "helper/icon" "tag" }}
|
|
||||||
{{ range ($Page.GetTerms "tags") }}
|
|
||||||
<a href="{{ .RelPermalink }}" class="link">{{ .LinkTitle }}</a>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
</footer>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
<!-- <div class="article-details">
|
|
||||||
{{ if .Params.categories }}
|
|
||||||
<header class="article-category">
|
|
||||||
{{ range (.GetTerms "tags") }}
|
|
||||||
<a href="{{ .RelPermalink }}" {{ with .Params.style }}style="background-color: {{ .background }}; color: {{ .color }};"{{ end }}>
|
|
||||||
{{ .LinkTitle }}
|
|
||||||
</a>
|
|
||||||
{{ 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>
|
|
||||||
|
|
||||||
{{ $showReadingTime := .Params.readingTime | default (.Site.Params.article.readingTime) }}
|
|
||||||
{{ $showDate := not .Date.IsZero }}
|
|
||||||
{{ $showFooter := or $showDate $showReadingTime }}
|
{{ $showFooter := or $showDate $showReadingTime }}
|
||||||
{{ if $showFooter }}
|
|
||||||
<footer class="article-time">
|
{{ if $showTime }}
|
||||||
{{ if $showDate }}
|
<footer class="article-meta">
|
||||||
<div>
|
<div class="inline-meta">
|
||||||
|
{{ if $showDate }}
|
||||||
{{ partial "helper/icon" "date" }}
|
{{ partial "helper/icon" "date" }}
|
||||||
<time class="article-time--published">
|
<time class="article-time--published" datetime='{{ $Page.Date.Format "2006-01-02T15:04:05Z07:00" }}'>
|
||||||
{{- .Date | time.Format (or .Site.Params.dateFormat.published "Jan 02, 2006") -}}
|
{{- $Page.Date | time.Format $Page.Site.Params.dateFormat.published -}}
|
||||||
</time>
|
</time>
|
||||||
</div>
|
{{ end }}
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ if $showReadingTime }}
|
{{ if $showReadingTime }}
|
||||||
<div>
|
{{ partial "helper/icon" "clock" }}
|
||||||
{{ partial "helper/icon" "stopwatch" }}
|
|
||||||
<time class="article-time--reading">
|
<time class="article-time--reading">
|
||||||
{{ T "article.readingTime" .ReadingTime }}
|
{{ T "article.readingTime" $Page.ReadingTime }}
|
||||||
</time>
|
</time>
|
||||||
</div>
|
{{ end }}
|
||||||
{{ end }}
|
</div>
|
||||||
|
|
||||||
{{- $date := .Date.Format "20060102" | int -}}
|
{{- $date := .Date.Format "20060102" | int -}}
|
||||||
{{- $lastmod := .Lastmod.Format "20060102" | int -}}
|
{{- $lastmod := .Lastmod.Format "20060102" | int -}}
|
||||||
{{- if gt $lastmod $date -}}
|
{{- if gt $lastmod $date -}}
|
||||||
@@ -133,4 +59,4 @@
|
|||||||
{{- end -}}
|
{{- end -}}
|
||||||
</footer>
|
</footer>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div> -->
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user