LoveIt/layouts/posts/single.html

95 lines
4.3 KiB
HTML
Raw Normal View History

2020-01-31 15:53:04 +01:00
{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}
2019-08-04 15:53:35 +02:00
2020-01-31 15:53:04 +01:00
{{- define "content" -}}
2020-02-24 10:00:39 +01:00
{{- $scratch := .Scratch.Get "scratch" -}}
2020-02-13 18:30:33 +01:00
<article class="page single">
{{- /* Title */ -}}
2020-02-13 18:30:33 +01:00
<h1 class="single-title animated flipInX">{{ .Title }}</h1>
{{- /* Meta */ -}}
<div class="post-meta">
<div class="post-meta-line">
{{- $author := .Params.author | default .Site.Author.name | default (T "author") -}}
{{- $authorLink := .Params.authorLink | default .Site.Author.link | default (relLangURL "/") -}}
<span class="post-author">
<a class="author" href="{{ $authorLink }}" rel="author" target="_blank">
<i class="fas fa-user-circle fa-fw"></i>{{ $author }}
</a>
</span>
2020-01-31 15:53:04 +01:00
{{- with .Params.categories -}}
&nbsp;<span class="post-category">
{{- T "included" -}}
2020-01-31 15:53:04 +01:00
{{- range . -}}
&nbsp;
<span>
<a href="{{ `/categories/` | relLangURL }}{{ urlize .}}">
<i class="far fa-folder fa-fw"></i>{{ . | humanize }}
</a>
</span>
2020-01-31 15:53:04 +01:00
{{- end -}}
2019-08-04 15:53:35 +02:00
</span>
2020-01-31 15:53:04 +01:00
{{- end -}}
2019-08-04 15:53:35 +02:00
</div>
<div class="post-meta-line">
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
<i class="far fa-calendar-alt fa-fw"></i><time datetime={{ $publish_date }}>{{ $publish_date }}</time>&nbsp;
<i class="fas fa-pencil-alt fa-fw"></i>{{ T "wordCount" .WordCount }}&nbsp;
<i class="far fa-clock fa-fw"></i>{{ T "readingTime" .ReadingTime }}&nbsp;
2020-02-24 10:00:39 +01:00
{{- if $scratch.Get "production" | and .Site.Params.valine.enable | and .Site.Params.valine.visitor -}}
<span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
2020-03-03 15:25:48 +01:00
<i class="far fa-eye fa-fw"></i><span class=leancloud-visitors-count></span>&nbsp;{{ T "views" }}
</span>&nbsp;
{{- end -}}
</div>
</div>
{{- /* Featured image */ -}}
{{- with .Params.featuredImage -}}
2020-02-13 18:30:33 +01:00
<div class="featured-image">
2020-02-27 13:14:40 +01:00
{{- partial "plugin/image.html" (dict "src" . "description" $.Description "scratch" $scratch) -}}
</div>
2020-01-31 15:53:04 +01:00
{{- end -}}
2019-08-19 21:01:15 +02:00
{{- /* TOC */ -}}
2020-01-31 15:53:04 +01:00
{{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
<div class="toc" id="toc-auto">
<h2 class="toc-title">{{ T "contents" }}</h2>
{{- $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }}
2020-02-21 04:11:56 +01:00
<div class="toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false)) }} always-active{{ end }}" id="toc-content-auto"></div>
</div>
<div class="toc" id="toc-static">
2019-08-19 21:01:15 +02:00
<details>
2020-01-31 15:53:04 +01:00
<summary>
2020-02-21 04:11:56 +01:00
<div class="toc-title">
<span>{{ T "contents" }}</span>
2020-01-31 15:53:04 +01:00
<span><i class="details icon fas fa-angle-down"></i></span>
</div>
</summary>
2020-02-21 04:11:56 +01:00
<div class="toc-content" id="toc-content-static">
{{- $toc := .TableOfContents -}}
{{- $toc = partial "function/fontawesome.html" $toc -}}
{{- $toc = partial "function/ruby.html" $toc -}}
{{- $toc | safeHTML -}}
2019-08-19 21:01:15 +02:00
</div>
</details>
2020-02-21 04:11:56 +01:00
</div>
2020-01-31 15:53:04 +01:00
{{- end -}}
{{- /* Content */ -}}
2020-02-24 10:00:39 +01:00
<div class="content" id="content">
2020-02-21 16:42:35 +01:00
{{- partial "single/content.html" .Content -}}
2019-08-04 15:53:35 +02:00
</div>
{{- /* Footer */ -}}
2020-02-21 16:42:35 +01:00
{{- partial "single/footer.html" . -}}
2019-08-04 15:53:35 +02:00
{{- /* Comment */ -}}
2020-02-13 18:30:33 +01:00
<div class="comment">
2020-01-31 15:53:04 +01:00
{{- if ( .Params.comment | default true ) -}}
2020-02-13 18:30:33 +01:00
{{- partial "comment.html" . -}}
2020-01-31 15:53:04 +01:00
{{- end -}}
2019-08-04 15:53:35 +02:00
</div>
</article>
2020-02-06 17:10:00 +01:00
{{- end -}}