2020-05-01 10:23:17 +02: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-04-21 16:55:06 +02:00
|
|
|
{{- $params := .Scratch.Get "params" -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
|
2020-05-12 16:40:49 +02:00
|
|
|
{{- $toc := $params.toc -}}
|
|
|
|
{{- if eq $toc true -}}
|
|
|
|
{{- $toc = .Site.Params.page.toc | default dict -}}
|
|
|
|
{{- else if eq $toc false -}}
|
|
|
|
{{- $toc = dict "enable" false -}}
|
|
|
|
{{- end -}}
|
|
|
|
|
2020-04-15 09:46:50 +02:00
|
|
|
{{- /* Auto TOC */ -}}
|
2020-05-12 16:40:49 +02:00
|
|
|
{{- if ne $toc.enable false -}}
|
2020-04-15 09:46:50 +02:00
|
|
|
<div class="toc" id="toc-auto">
|
|
|
|
<h2 class="toc-title">{{ T "contents" }}</h2>
|
2020-05-12 16:40:49 +02:00
|
|
|
<div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}" id="toc-content-auto"></div>
|
2020-04-15 09:46:50 +02:00
|
|
|
</div>
|
|
|
|
{{- end -}}
|
|
|
|
|
2020-02-13 18:30:33 +01:00
|
|
|
<article class="page single">
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* Title */ -}}
|
2022-05-06 20:22:58 +02:00
|
|
|
<h1 class="single-title animate__animated animate__flipInX">{{ .Title }}</h1>
|
2020-04-21 16:55:06 +02:00
|
|
|
|
|
|
|
{{- /* Subtitle */ -}}
|
|
|
|
{{- with $params.subtitle -}}
|
2020-03-16 09:14:37 +01:00
|
|
|
<h2 class="single-subtitle">{{ . }}</h2>
|
|
|
|
{{- end -}}
|
2019-08-16 21:40:34 +02:00
|
|
|
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* Meta */ -}}
|
2020-02-21 05:49:55 +01:00
|
|
|
<div class="post-meta">
|
|
|
|
<div class="post-meta-line">
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
|
2020-04-22 15:34:38 +02:00
|
|
|
{{- $authorLink := $params.authorlink | default .Site.Author.link | default .Site.Home.RelPermalink -}}
|
2020-02-21 05:49:55 +01:00
|
|
|
<span class="post-author">
|
2020-05-28 11:05:37 +02:00
|
|
|
{{- $options := dict "Class" "author" "Destination" $authorLink "Title" "Author" "Rel" "author" "Icon" (dict "Class" "fas fa-user-circle fa-fw") "Content" $author -}}
|
2020-03-17 14:16:04 +01:00
|
|
|
{{- partial "plugin/link.html" $options -}}
|
2020-02-21 05:49:55 +01:00
|
|
|
</span>
|
|
|
|
|
2020-05-18 10:10:24 +02:00
|
|
|
{{- $categories := slice -}}
|
|
|
|
{{- range .Params.categories -}}
|
2020-05-18 11:30:37 +02:00
|
|
|
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
|
2022-05-06 19:54:31 +02:00
|
|
|
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw" aria-hidden="true"></i>%v</a>` $category.RelPermalink $category.Title) -}}
|
2020-05-18 10:10:24 +02:00
|
|
|
{{- end -}}
|
|
|
|
{{- with delimit $categories " " -}}
|
|
|
|
<span class="post-category">
|
|
|
|
{{- dict "Categories" . | T "includedInCategories" | safeHTML -}}
|
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>
|
2020-02-21 05:49:55 +01:00
|
|
|
<div class="post-meta-line">
|
2020-05-18 10:10:24 +02:00
|
|
|
{{- with .Site.Params.dateformat | default "2006-01-02" | .PublishDate.Format -}}
|
2022-05-06 19:54:31 +02:00
|
|
|
<i class="far fa-calendar-alt fa-fw" aria-hidden="true"></i> <time datetime="{{ . }}">{{ . }}</time>
|
2020-05-18 10:10:24 +02:00
|
|
|
{{- end -}}
|
2022-05-06 19:54:31 +02:00
|
|
|
<i class="fas fa-pencil-alt fa-fw" aria-hidden="true"></i> {{ T "wordCount" .WordCount }}
|
|
|
|
<i class="far fa-clock fa-fw" aria-hidden="true"></i> {{ T "readingTime" .ReadingTime }}
|
2020-04-22 11:50:30 +02:00
|
|
|
{{- $comment := .Scratch.Get "comment" | default dict -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- if $comment.enable | and $comment.valine.enable | and $comment.valine.visitor -}}
|
2020-04-22 15:34:38 +02:00
|
|
|
<span id="{{ .RelPermalink }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
|
2022-05-06 19:54:31 +02:00
|
|
|
<i class="far fa-eye fa-fw" aria-hidden="true"></i> <span class=leancloud-visitors-count></span> {{ T "views" }}
|
2019-08-26 19:15:00 +02:00
|
|
|
</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-05-28 11:05:37 +02:00
|
|
|
{{- $image := $params.featuredimage -}}
|
|
|
|
{{- with .Resources.GetMatch "featured-image" -}}
|
|
|
|
{{- $image = .RelPermalink -}}
|
|
|
|
{{- end -}}
|
|
|
|
{{- with $image -}}
|
2020-02-13 18:30:33 +01:00
|
|
|
<div class="featured-image">
|
2020-05-28 11:05:37 +02:00
|
|
|
{{- dict "Src" . "Title" $.Description "Resources" $.Resources | partial "plugin/image.html" -}}
|
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-04-15 09:46:50 +02:00
|
|
|
{{- /* Static TOC */ -}}
|
2020-05-12 16:40:49 +02:00
|
|
|
{{- if ne $toc.enable false -}}
|
2020-11-27 09:12:26 +01:00
|
|
|
<div class="details toc" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ end }}">
|
2020-04-25 21:25:10 +02:00
|
|
|
<div class="details-summary toc-title">
|
|
|
|
<span>{{ T "contents" }}</span>
|
2022-05-06 19:54:31 +02:00
|
|
|
<span><i class="details-icon fas fa-angle-right" aria-hidden="true"></i></span>
|
2020-04-25 21:25:10 +02:00
|
|
|
</div>
|
|
|
|
<div class="details-content toc-content" id="toc-content-static">
|
2020-05-18 15:30:33 +02:00
|
|
|
{{- dict "Content" .TableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
2020-04-25 21:25:10 +02:00
|
|
|
</div>
|
2020-02-21 04:11:56 +01:00
|
|
|
</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 */ -}}
|
2020-02-24 10:00:39 +01:00
|
|
|
<div class="content" id="content">
|
2020-05-18 15:30:33 +02:00
|
|
|
{{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
</div>
|
|
|
|
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* Footer */ -}}
|
2020-02-21 16:42:35 +01:00
|
|
|
{{- partial "single/footer.html" . -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
|
2020-02-03 11:38:10 +01:00
|
|
|
{{- /* Comment */ -}}
|
2020-04-21 16:55:06 +02:00
|
|
|
{{- partial "comment.html" . -}}
|
2019-08-04 15:53:35 +02:00
|
|
|
</article>
|
2020-02-06 17:10:00 +01:00
|
|
|
{{- end -}}
|