feat: improve configuration (#245)
* feat: improve configuration * fix: fix partials/footer.html error
This commit is contained in:
@@ -1,35 +1,36 @@
|
||||
{{- define "title" }}{{ .Title }} | {{ .Site.Title }}{{ end -}}
|
||||
|
||||
{{- define "content" -}}
|
||||
{{- $scratch := .Scratch.Get "scratch" -}}
|
||||
{{- $params := .Scratch.Get "params" -}}
|
||||
|
||||
{{- /* Auto TOC */ -}}
|
||||
{{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
|
||||
{{- if ne $params.toc.enable false -}}
|
||||
<div class="toc" id="toc-auto">
|
||||
<h2 class="toc-title">{{ T "contents" }}</h2>
|
||||
{{- $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default true }}
|
||||
<div class="toc-content{{ if not (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false)) }} always-active{{ end }}" id="toc-content-auto"></div>
|
||||
<div class="toc-content{{ if eq $params.toc.auto false }} always-active{{ end }}" id="toc-content-auto"></div>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
<article class="page single">
|
||||
{{- /* Title */ -}}
|
||||
<h1 class="single-title animated flipInX">{{ .Title }}</h1>
|
||||
{{- with .Params.subtitle -}}
|
||||
|
||||
{{- /* 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 (relLangURL "/") -}}
|
||||
{{- $author := $params.author | default .Site.Author.name | default (T "author") -}}
|
||||
{{- $authorLink := $params.authorlink | default .Site.Author.link | default (relLangURL "/") -}}
|
||||
<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>
|
||||
|
||||
{{- with .Params.categories -}}
|
||||
{{- with $params.categories -}}
|
||||
|
||||
<span class="post-category">
|
||||
{{- T "included" -}}
|
||||
@@ -43,11 +44,12 @@
|
||||
{{- end -}}
|
||||
</div>
|
||||
<div class="post-meta-line">
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateFormatToUse | default "2006-01-02") -}}
|
||||
{{- $publish_date := .PublishDate.Format (.Site.Params.dateformat | default "2006-01-02") -}}
|
||||
<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 }}
|
||||
{{- if eq hugo.Environment "production" | and .Site.Params.comment.valine.enable | and .Site.Params.comment.valine.visitor -}}
|
||||
{{- $comment := $params.comment | default dict -}}
|
||||
{{- if $comment.enable | and $comment.valine.enable | and $comment.valine.visitor -}}
|
||||
<span id="{{ .RelPermalink | relURL }}" class="leancloud_visitors" data-flag-title="{{ .Title }}">
|
||||
<i class="far fa-eye fa-fw"></i><span class=leancloud-visitors-count></span> {{ T "views" }}
|
||||
</span>
|
||||
@@ -56,14 +58,14 @@
|
||||
</div>
|
||||
|
||||
{{- /* Featured image */ -}}
|
||||
{{- with .Params.featuredImage -}}
|
||||
{{- with $params.featuredimage -}}
|
||||
<div class="featured-image">
|
||||
{{- partial "plugin/image.html" (dict "src" . "alt" $.Description "large" true) -}}
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
{{- /* Static TOC */ -}}
|
||||
{{- if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) -}}
|
||||
{{- if $params.toc.enable -}}
|
||||
<div class="toc" id="toc-static">
|
||||
<details>
|
||||
<summary>
|
||||
@@ -84,15 +86,13 @@
|
||||
|
||||
{{- /* Content */ -}}
|
||||
<div class="content" id="content">
|
||||
{{- partial "function/content.html" .Content | safeHTML -}}
|
||||
{{- dict "content" .Content "ruby" $params.ruby "fraction" $params.fraction "fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
|
||||
</div>
|
||||
|
||||
{{- /* Footer */ -}}
|
||||
{{- partial "single/footer.html" . -}}
|
||||
|
||||
{{- /* Comment */ -}}
|
||||
{{- if ( .Params.comment | default true ) -}}
|
||||
{{- partial "comment.html" . -}}
|
||||
{{- end -}}
|
||||
{{- partial "comment.html" . -}}
|
||||
</article>
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user