refactor: change default article layout

Post layout become exclusive for `post` section (with toolbar)
Page layout become the default layout (without toolbar)
This commit is contained in:
Jimmy Cai 2020-09-13 10:59:52 +02:00
parent 294f445e0a
commit 45e7e07a86
No known key found for this signature in database
GPG Key ID: 3EA408E527F37B18
3 changed files with 24 additions and 24 deletions

View File

@ -1,21 +1,12 @@
{{ define "container-class" }}article-page with-toolbar{{ end }} {{ define "body-class" }}article-page keep-sidebar{{ end }}
{{ define "main" }} {{ define "main" }}
<div id="article-toolbar">
<a href="{{ .Site.BaseURL }}" class="back-home">
{{ (resources.Get "icons/back.svg").Content | safeHTML }}
<span>Back</span>
</a>
</div>
{{ partial "article/article.html" . }} {{ partial "article/article.html" . }}
{{ partial "article/components/related-contents" . }}
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}} {{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
{{ partial "comments/include" . }} {{ partial "comments/include" . }}
{{ end }} {{ end }}
{{ partialCached "footer/footer" . }} {{ partialCached "footer/footer" . }}
{{- partial "article/components/photoswipe.html" . -}} {{ partial "article/components/photoswipe" . }}
{{ end }} {{ end }}

View File

@ -1,12 +0,0 @@
{{ define "body-class" }}article-page keep-sidebar{{ end }}
{{ define "main" }}
{{ partial "article/article.html" . }}
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
{{ partial "comments/include" . }}
{{ end }}
{{ partialCached "footer/footer" . }}
{{ partial "article/components/photoswipe" . }}
{{ end }}

21
layouts/post/single.html Normal file
View File

@ -0,0 +1,21 @@
{{ define "container-class" }}article-page with-toolbar{{ end }}
{{ define "main" }}
<div id="article-toolbar">
<a href="{{ .Site.BaseURL }}" class="back-home">
{{ (resources.Get "icons/back.svg").Content | safeHTML }}
<span>Back</span>
</a>
</div>
{{ partial "article/article.html" . }}
{{ partial "article/components/related-contents" . }}
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
{{ partial "comments/include" . }}
{{ end }}
{{ partialCached "footer/footer" . }}
{{- partial "article/components/photoswipe.html" . -}}
{{ end }}