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-13 06:30:58 +01:00
|
|
|
<article class="page post">
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* Title */ -}}
|
2019-08-24 13:32:41 +02:00
|
|
|
<h1 class="post-title animated flipInX">{{ .Title }}</h1>
|
2019-08-16 21:40:34 +02:00
|
|
|
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* Meta */ -}}
|
2019-08-16 21:40:34 +02:00
|
|
|
<div class="post-meta">
|
|
|
|
<div class="post-meta-main">
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- $author := .Params.author | default .Site.Author.name -}}
|
|
|
|
{{- $author_link := .Params.author_link | default .Site.Author.link | default .Site.BaseURL -}}
|
2020-01-31 18:52:27 +01:00
|
|
|
<a class="author" href="{{ $author_link }}" rel="author" target="_blank">
|
2020-02-03 11:38:10 +01:00
|
|
|
<i class="fas fa-user-circle fa-fw"></i>{{ $author }}
|
|
|
|
</a>
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- with .Params.categories -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
<span class="post-category">
|
2020-01-31 18:52:27 +01:00
|
|
|
{{- T "included" -}}
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- range . -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
{{- $name := . -}}
|
|
|
|
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
|
2020-02-03 11:38:10 +01:00
|
|
|
<i class="far fa-folder fa-fw"></i><a href="{{ .Permalink }}">{{ $name | humanize }}</a>
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- end -}}
|
|
|
|
{{- 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>
|
2019-08-16 21:40:34 +02:00
|
|
|
<div class="post-meta-other">
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
|
2019-08-26 19:15:00 +02:00
|
|
|
<i class="far fa-calendar-alt fa-fw"></i><time datetime={{ $publish_date }}>{{ $publish_date }}</time>
|
|
|
|
<i class="fas fa-pencil-alt fa-fw"></i>{{ T "wordCount" .WordCount }}
|
|
|
|
<i class="far fa-clock fa-fw"></i>{{ T "readingTime" .ReadingTime }}
|
2019-08-22 20:01:22 +02:00
|
|
|
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.valine.enable | and .Site.Params.valine.visitor -}}
|
2019-08-17 17:16:09 +02:00
|
|
|
<span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
|
2019-08-26 19:15:00 +02:00
|
|
|
<i class="far fa-eye fa-fw"></i>{{ T "pageviews" | safeHTML }}
|
|
|
|
</span>
|
2019-08-17 17:16:09 +02:00
|
|
|
{{- end -}}
|
2019-08-16 21:40:34 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* Featured image */ -}}
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- with .Params.featured_image -}}
|
2019-08-22 20:01:22 +02:00
|
|
|
<div class="post-featured-image">
|
2020-02-03 04:46:30 +01:00
|
|
|
{{- partial "image" . -}}
|
2019-08-22 20:01:22 +02:00
|
|
|
</div>
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- end -}}
|
2019-08-19 21:01:15 +02:00
|
|
|
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* TOC */ -}}
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
|
2019-08-17 17:16:09 +02:00
|
|
|
<div class="post-toc" id="post-toc">
|
|
|
|
<h2 class="post-toc-title">{{ T "toc" }}</h2>
|
2020-01-31 18:52:27 +01:00
|
|
|
{{- $globalAutoCollapseToc := .Site.Params.auto_collapse_toc | default true }}
|
|
|
|
<div class="post-toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.auto_collapse_toc false)) }} always-active{{ end }}">
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- .TableOfContents -}}
|
2019-08-17 17:16:09 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-08-19 21:01:15 +02:00
|
|
|
<div class="post-toc-mobile" id="post-toc-mobile">
|
|
|
|
<details>
|
2020-01-31 15:53:04 +01:00
|
|
|
<summary>
|
|
|
|
<div class="post-toc-title">
|
|
|
|
<span>{{ T "toc" }}</span>
|
|
|
|
<span><i class="details icon fas fa-angle-down"></i></span>
|
|
|
|
</div>
|
|
|
|
</summary>
|
2019-08-19 21:01:15 +02:00
|
|
|
<div class="post-toc-content">
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- $toc := .TableOfContents -}}
|
|
|
|
{{- $toc = replaceRE `id="TableOfContents"` `id="TableOfContentsMobile"` $toc -}}
|
|
|
|
{{- $toc | safeHTML -}}
|
2019-08-19 21:01:15 +02:00
|
|
|
</div>
|
|
|
|
</details>
|
|
|
|
</div>
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- end -}}
|
2019-08-17 17:16:09 +02:00
|
|
|
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* Content */ -}}
|
2019-08-18 19:36:52 +02:00
|
|
|
<div class="post-content">
|
2020-02-03 04:46:30 +01:00
|
|
|
{{- partial "hook/content.html" .Content | safeHTML -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
</div>
|
|
|
|
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* Footer */ -}}
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- partial "post/footer.html" . -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* Comment */ -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
<div class="post-comment">
|
2020-01-31 15:53:04 +01:00
|
|
|
{{- if ( .Params.comment | default true ) -}}
|
|
|
|
{{- partial "comments.html" . -}}
|
|
|
|
{{- end -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
</div>
|
|
|
|
</article>
|
2020-02-06 17:10:00 +01:00
|
|
|
{{- end -}}
|