mirror of
https://github.com/dillonzq/LoveIt.git
synced 2024-12-04 22:15:08 +01:00
89 lines
No EOL
4.5 KiB
HTML
89 lines
No EOL
4.5 KiB
HTML
{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }}
|
|
|
|
{{ define "content" }}
|
|
{{ $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") }}
|
|
{{ $author := .Site.Author.name }}
|
|
{{ if isset .Params "author" }}
|
|
{{ $author = .Site.Author.name }}
|
|
{{ end }}
|
|
|
|
<article class="post-warp">
|
|
<header class="post-header">
|
|
<h1 class="post-title">{{ .Title }}</h1>
|
|
</header>
|
|
|
|
<div class="post-meta">
|
|
<div class="post-meta-main">
|
|
<a class="author" href="{{.Site.BaseURL }}" rel="author"><i class="fas fa-user-circle"></i> {{ $author }} </a>
|
|
{{ with .Params.categories -}}
|
|
<span class="post-category">
|
|
{{ T "included" }}
|
|
{{ range . }}
|
|
{{- $name := . -}}
|
|
{{- with $.Site.GetPage "taxonomy" (printf "categories/%s" $name) | default ($.Site.GetPage "taxonomy" (printf "categories/%s" ($name | urlize))) -}}
|
|
<i class="far fa-folder"></i> <a href="{{ .Permalink }}">{{ $name }}</a>
|
|
{{ end -}}
|
|
{{ end }}
|
|
</span>
|
|
{{- end }}
|
|
</div>
|
|
<div class="post-meta-other">
|
|
<span class="post-time"><i class="far fa-calendar-alt"></i> <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 }}
|
|
{{- if eq (getenv "HUGO_ENV") "production" | and .Site.Params.valine.enable | and .Site.Params.valine.visitor -}}
|
|
<span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
|
|
<i class="far fa-eye"></i> {{ T "pageviews" | safeHTML }}
|
|
</span>
|
|
{{- end -}}
|
|
</div>
|
|
</div>
|
|
|
|
{{ with .Params.featured_image }}
|
|
<img src=/images/loading.svg data-sizes=auto data-src={{ . }} alt="featured image" class="featured_image lazyload">
|
|
{{ end }}
|
|
|
|
{{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
|
|
<div class="post-toc" id="post-toc">
|
|
<h2 class="post-toc-title">{{ T "toc" }}</h2>
|
|
{{- $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }}
|
|
<div class="post-toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false)) }} always-active{{ end }}">
|
|
{{ .TableOfContents }}
|
|
</div>
|
|
</div>
|
|
<div class="post-toc-mobile" id="post-toc-mobile">
|
|
<details>
|
|
<summary class="post-toc-title">{{ T "toc" }}<i class="details icon fas fa-angle-down"></i></summary>
|
|
<div class="post-toc-content">
|
|
{{ .TableOfContents }}
|
|
</div>
|
|
</details>
|
|
</div>
|
|
{{- end }}
|
|
|
|
<div class="post-content">
|
|
{{ $content := .Content }}
|
|
{{ $REin := `<img src="([^"]+)" alt="([^"]+)?" />` }}
|
|
{{ $REout := "<figure><img src=/images/loading.svg data-sizes=auto data-src=$1 alt=$2 class=lazyload><figcaption class=image-caption>$2</figcaption></figure>" }}
|
|
{{ $content = replaceRE $REin $REout $content }}
|
|
{{ $REin = `<img src="([^"]+)" alt="([^"]+)?" title="([^"]+)?" />` }}
|
|
{{ $REout = "<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>" }}
|
|
{{ $content = replaceRE $REin $REout $content }}
|
|
{{ $REin = `:\(([\w- ]+?)\):` }}
|
|
{{ $REout = `<i class="inline-icon $1"></i>` }}
|
|
{{ $content = replaceRE $REin $REout $content }}
|
|
{{ $REin = `\[(.+?)\]\^\((.+?)\)` }}
|
|
{{ $REout = `<strong><ruby>$1<rt>$2</rt></ruby></strong>` }}
|
|
{{ $content = replaceRE $REin $REout $content }}
|
|
{{ $content | safeHTML }}
|
|
</div>
|
|
|
|
{{ partial "post/footer.html" . }}
|
|
|
|
<div class="post-comment">
|
|
{{ if ( .Params.comment | default true ) }}
|
|
{{ partial "comments.html" . }}
|
|
{{ end }}
|
|
</div>
|
|
</article>
|
|
{{- end }} |