LoveIt/layouts/posts/single.html

98 lines
4.5 KiB
HTML
Raw Normal View History

{{- define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end -}}
2019-08-04 15:53:35 +02:00
2020-01-31 15:53:04 +01:00
{{- define "content" -}}
{{- $params := .Scratch.Get "params" -}}
{{- $toc := $params.toc -}}
{{- if eq $toc true -}}
{{- $toc = .Site.Params.page.toc | default dict -}}
{{- else if eq $toc false -}}
{{- $toc = dict "enable" false -}}
{{- end -}}
{{- /* Auto TOC */ -}}
{{- if ne $toc.enable false -}}
<div class="toc" id="toc-auto">
<h2 class="toc-title">{{ T "contents" }}</h2>
<div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}" id="toc-content-auto"></div>
</div>
{{- end -}}
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>
{{- /* Subtitle */ -}}
{{- with $params.subtitle -}}
<h2 class="single-subtitle">{{ . }}</h2>
{{- end -}}
{{- /* 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 .Site.Home.RelPermalink -}}
<span class="post-author">
{{- $options := dict "class" "author" "href" $authorLink "title" "Author" "rel" "author" "icon" (dict "class" "fas fa-user-circle fa-fw") "content" $author -}}
{{- partial "plugin/link.html" $options -}}
</span>
2020-05-18 10:10:24 +02:00
{{- $categories := slice -}}
{{- range .Params.categories -}}
{{- $category := partialCached "function/path.html" . . | printf "/categories/%v" | $.Site.GetPage -}}
2020-05-18 10:10:24 +02:00
{{- $categories = $categories | append (printf `<a href="%v"><i class="far fa-folder fa-fw"></i>%v</a>` $category.RelPermalink $category.Title) -}}
{{- end -}}
{{- with delimit $categories "&nbsp;" -}}
&nbsp;<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>
<div class="post-meta-line">
2020-05-18 10:10:24 +02:00
{{- with .Site.Params.dateformat | default "2006-01-02" | .PublishDate.Format -}}
<i class="far fa-calendar-alt fa-fw"></i>&nbsp;<time datetime="{{ . }}">{{ . }}</time>&nbsp;
{{- end -}}
2020-05-14 10:14:14 +02:00
<i class="fas fa-pencil-alt fa-fw"></i>&nbsp;{{ T "wordCount" .WordCount }}&nbsp;
<i class="far fa-clock fa-fw"></i>&nbsp;{{ T "readingTime" .ReadingTime }}&nbsp;
{{- $comment := .Scratch.Get "comment" | default dict -}}
{{- if $comment.enable | and $comment.valine.enable | and $comment.valine.visitor -}}
<span id="{{ .RelPermalink }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
2020-05-14 10:14:14 +02:00
<i class="far fa-eye fa-fw"></i>&nbsp;<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">
{{- dict "src" . "alt" $.Description "large" true | partial "plugin/image.html" -}}
</div>
2020-01-31 15:53:04 +01:00
{{- end -}}
2019-08-19 21:01:15 +02:00
{{- /* Static TOC */ -}}
{{- if ne $toc.enable false -}}
<div class="details toc" id="toc-static">
<div class="details-summary toc-title">
<span>{{ T "contents" }}</span>
2020-04-27 19:38:22 +02:00
<span><i class="details-icon fas fa-angle-right"></i></span>
</div>
<div class="details-content toc-content" id="toc-content-static">
{{- dict "content" .TableOfContents "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
</div>
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">
{{- 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>
{{- /* Footer */ -}}
2020-02-21 16:42:35 +01:00
{{- partial "single/footer.html" . -}}
2019-08-04 15:53:35 +02:00
{{- /* Comment */ -}}
{{- partial "comment.html" . -}}
2019-08-04 15:53:35 +02:00
</article>
2020-02-06 17:10:00 +01:00
{{- end -}}