2019-08-04 15:53:35 +02:00
|
|
|
{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }}
|
|
|
|
|
|
|
|
{{ define "content" }}
|
|
|
|
{{ $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}
|
|
|
|
{{ $modify_date := .Lastmod.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}
|
2019-08-16 21:40:34 +02:00
|
|
|
{{ $author := .Site.Author.name }}
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ if isset .Params "author" }}
|
2019-08-16 21:40:34 +02:00
|
|
|
{{ $author = .Site.Author.name }}
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
<article class="post-warp">
|
|
|
|
<header class="post-header">
|
|
|
|
<h1 class="post-title">{{ .Title }}</h1>
|
2019-08-16 21:40:34 +02:00
|
|
|
</header>
|
|
|
|
|
|
|
|
<div class="post-meta">
|
|
|
|
<div class="post-meta-main">
|
2019-08-04 15:53:35 +02:00
|
|
|
<a href="{{.Site.BaseURL }}" rel="author">{{ $author }}</a>
|
2019-08-16 21:40:34 +02:00
|
|
|
{{ T "included" }}
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ with .Params.categories -}}
|
|
|
|
<span class="post-category">
|
|
|
|
{{ range . }}
|
|
|
|
{{- $name := . -}}
|
|
|
|
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
|
2019-08-16 22:48:39 +02:00
|
|
|
<i class="far fa-folder"></i>
|
2019-08-04 15:53:35 +02:00
|
|
|
<a href="{{ .Permalink }}">{{ $name }}</a>
|
|
|
|
{{ end -}}
|
|
|
|
{{ end }}
|
|
|
|
</span>
|
|
|
|
{{- end }}
|
|
|
|
</div>
|
2019-08-16 21:40:34 +02:00
|
|
|
<div class="post-meta-other">
|
2019-08-16 22:48:39 +02:00
|
|
|
<i class="far fa-calendar-alt"></i>
|
2019-08-16 22:53:27 +02:00
|
|
|
<span class="post-time"><time datetime={{ $publish_date }}>{{ $publish_date }}</time></span>
|
|
|
|
<i class="fas fa-pencil-alt"></i>
|
|
|
|
{{ T "wordCount" .WordCount }}
|
|
|
|
<i class="far fa-clock"></i>
|
|
|
|
{{ T "readingTime" .ReadingTime }}
|
2019-08-16 21:40:34 +02:00
|
|
|
{{ if and .Site.Params.valine.enable .Site.Params.valine.visitor }}
|
|
|
|
<span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
|
2019-08-16 22:53:27 +02:00
|
|
|
<i class="far fa-eye"></i>
|
2019-08-16 21:40:34 +02:00
|
|
|
{{ T "pageviews" | safeHTML }}
|
|
|
|
</span>
|
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2019-08-04 15:53:35 +02:00
|
|
|
<div class="post-content">
|
|
|
|
<!--featured_image-->
|
|
|
|
{{ with .Params.featured_image }}
|
2019-08-11 19:36:19 +02:00
|
|
|
<img src="{{ . }}" class="featured_image">
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ end }}
|
|
|
|
<!-- end featured_image-->
|
|
|
|
|
2019-08-11 19:36:19 +02:00
|
|
|
{{ $reAltIn := `<img src="([^"]+)" alt="([^"]+)?" />` }}
|
|
|
|
{{ $reAltOut := "<figure><img src=/images/loading.svg data-sizes=auto data-src=$1 alt=$2 class=lazyload><figcaption class=image-caption>$2</figcaption></figure>" }}
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ $altContent := .Content | replaceRE $reAltIn $reAltOut | safeHTML }}
|
2019-08-11 19:36:19 +02:00
|
|
|
{{ $reAltTitleIn := `<img src="([^"]+)" alt="([^"]+)?" title="([^"]+)?" />` }}
|
|
|
|
{{ $reAltTitleOut := "<figure><img src=/images/loading.svg data-src=$1 data-sizes=auto alt=$2 title=$3 class=lazyload><figcaption class=image-caption>$2</figcaption></figure>" }}
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ $finalContent := $altContent | replaceRE $reAltTitleIn $reAltTitleOut | safeHTML }}
|
|
|
|
{{ $finalContent }}
|
|
|
|
</div>
|
|
|
|
|
2019-08-16 21:40:34 +02:00
|
|
|
<div class="post-info">
|
|
|
|
<p class="post-info-item">
|
2019-08-04 15:53:35 +02:00
|
|
|
<span>{{ T "lastMod" }}:</span>
|
|
|
|
<span>{{ $modify_date }}</span>
|
|
|
|
</p>
|
|
|
|
|
2019-08-16 21:40:34 +02:00
|
|
|
<p class="post-info-item">
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ if and ( $.Param "socialShare" ) (gt (len ($.Param "share")) 0) }}
|
2019-08-16 21:40:34 +02:00
|
|
|
<span>{{ T "share" }}:</span>
|
|
|
|
<span>{{ partial "post/share-links.html" . }}</span>
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ end }}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="post-tags">
|
|
|
|
<section>
|
2019-08-16 21:40:34 +02:00
|
|
|
{{ with .Params.tags }}
|
|
|
|
{{ range . }}
|
|
|
|
<span class="tag">
|
|
|
|
<i class="fas fa-tag"></i><a href="{{ "tags/" | absURL }}{{ . | urlize }}/"> {{.}} </a>
|
|
|
|
</span>
|
|
|
|
{{ end }}
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ end }}
|
|
|
|
</section>
|
|
|
|
<section>
|
2019-08-06 05:44:15 +02:00
|
|
|
<span><a href="javascript:window.history.back();">{{ T "back" }}</a></span>
|
2019-08-06 05:42:24 +02:00
|
|
|
|
|
2019-08-04 15:53:35 +02:00
|
|
|
<span><a href="{{ .Site.BaseURL }}">{{ T "home" }}</a></span>
|
|
|
|
</section>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="post-nav">
|
|
|
|
{{ if .PrevInSection }}
|
2019-08-16 21:40:34 +02:00
|
|
|
<a href="{{.PrevInSection.Permalink}}" class="prev" rel="prev" title="{{ .PrevInSection.Title}}"><i class="fas fa-angle-left"></i> {{ .PrevInSection.Title}}</a>
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ end }}
|
|
|
|
{{ if .NextInSection }}
|
2019-08-16 21:40:34 +02:00
|
|
|
<a href="{{.NextInSection.Permalink}}" class="next" rel="next" title="{{.NextInSection.Title}}">{{.NextInSection.Title}} <i class="fas fa-angle-right"></i></a>
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="post-comment">
|
|
|
|
{{ if ( .Params.showComments | default true ) }}
|
2019-08-05 15:15:01 +02:00
|
|
|
{{ partial "comments.html" . }}
|
2019-08-04 15:53:35 +02:00
|
|
|
{{ end }}
|
|
|
|
</div>
|
|
|
|
</article>
|
|
|
|
{{- end }}
|