diff options
author | dataCobra <datacobra@thinkbot.de> | 2021-03-06 18:04:52 +0300 |
---|---|---|
committer | dataCobra <datacobra@thinkbot.de> | 2021-03-06 18:04:52 +0300 |
commit | 84d7e72c4dfa4cc888e801548671499d04b16f47 (patch) | |
tree | 67202770d55e8ac114fab1730484300d8789a0ce /layouts | |
parent | 0c90cda3527861708eedd8cc71ba98e9c10ba869 (diff) |
Refactoring of single.html
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/single.html | 92 |
1 files changed, 43 insertions, 49 deletions
diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1c1af60..003dd4e 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,34 +1,28 @@ {{- define "main" }} <div class="post"> -{{ if isset .Params "image" }} +{{- if isset .Params "image" }} <div class="post-image"> <img src="{{ relURL .Params.image }}" {{ if isset .Params "imagetext" }}alt="{{ .Params.imagetext }}"{{ end }}> </div> -{{ end }} +{{- end }} <div class="author"> -{{ if eq .Site.Params.listAuthor true}} -{{ if isset .Params "author" }} -<p> -{{ if isset .Params "authorlink" }} -{{ i18n "authorpretext" }} <a href="{{ relURL .Params.authorlink }}" target="_blank" rel="noopener noreferrer">{{ .Params.author }}</a> -{{ else }} -{{ i18n "authorpretext" }} {{ .Params.author }} -{{ end }} -</p> -{{ end }} -{{ end }} +{{- if eq .Site.Params.listAuthor true}} +{{- if isset .Params "author" }} +<p>{{ if isset .Params "authorlink" }}{{ i18n "authorpretext" }} <a href="{{ relURL .Params.authorlink }}" target="_blank" rel="noopener noreferrer">{{ .Params.author }}</a>{{- else }}{{ i18n "authorpretext" }} {{ .Params.author }}{{ end }}</p> +{{- end }} +{{- end }} </div> <div class="post-header"> -{{ if ne .Date.Year 1 }} +{{- if ne .Date.Year 1 }} <div class="meta"> -{{ if not .Params.nodate }} +{{- if not .Params.nodate }} <div class="date"> <span class="day">{{ dateFormat "02" .Date }}</span> <span class="rest">{{ if $.Site.Data.month }}{{ index $.Site.Data.month (printf "%d" .Date.Month) }} {{ .Date.Year }}{{ else }}{{ dateFormat "Jan 2006" .Date }}{{ end }}</span> </div> -{{ end }} +{{- end }} </div> -{{ end }} +{{- end }} <div class="matter"> <h1 class="title">{{ .Title }}</h1> </div> @@ -36,49 +30,49 @@ <div class="markdown"> {{ .Content }} </div> -{{ if ne (in .Site.Params.disableTaxoTypes .Type) true }} -{{ $pagename := .Page.Title }} -{{ $notaxo := .Params.notaxonomy }} -{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }} -{{ with index $.Params $taxonomyname }} -{{ with ($.Site.GetPage (printf "/%s" $taxonomyname)) }} -{{ if in $notaxo $taxonomyname }} -{{ else }} +{{- if ne (in .Site.Params.disableTaxoTypes .Type) true }} +{{- $pagename := .Page.Title }} +{{- $notaxo := .Params.notaxonomy }} +{{- range $taxonomyname, $taxonomy := .Site.Taxonomies }} +{{- with index $.Params $taxonomyname }} +{{- with ($.Site.GetPage (printf "/%s" $taxonomyname)) }} +{{- if in $notaxo $taxonomyname }} +{{- else }} <div class="tags"> <div class="taxosfloating_left"> <p>{{ $taxonomyname | humanize }}</p> </div> <div class="termsfloating_right"> <p> -{{ range $key, $value := $taxonomy }} -{{ range $value.Pages }} -{{ if eq .LinkTitle $pagename }} -<a href="{{ relURL $taxonomyname }}/{{ $key }}/"> {{ $key }} </a> -{{ end }} -{{ end }} -{{ end }} +{{- range $key, $value := $taxonomy -}} +{{- range $value.Pages }} +{{- if eq .LinkTitle $pagename }} +<a href="{{ relURL $taxonomyname }}/{{ $key }}/">{{ $key }}</a> +{{- end }} +{{- end }} +{{- end }} </p> </div> <div class="clearit"></div> -{{ end }} -{{ end }} -{{ end }} -{{ end }} -{{ end }} -</div> -{{- if eq .Site.Params.comments.enabled true -}} -{{- $.Scratch.Set "comments" true -}} -{{- if and (isset .Params "type") (in .Site.Params.comments.disableOnTypes .Params.type) -}} -{{- $.Scratch.Set "comments" false -}} -{{- end -}} -{{- if and (isset .Params "commentable") (eq .Params.commentable false) -}} -{{- $.Scratch.Set "comments" false -}} -{{- else if and (isset .Params "commentable") (eq .Params.commentable true) -}} -{{- $.Scratch.Set "comments" true -}} +{{- end }} {{- end -}} -{{- if eq ($.Scratch.Get "comments") true -}} -{{- partial "comments.html" . -}} {{- end -}} {{- end -}} +{{- end }} +</div> +{{- if eq .Site.Params.comments.enabled true }} +{{- $.Scratch.Set "comments" true }} +{{- if and (isset .Params "type") (in .Site.Params.comments.disableOnTypes .Params.type) }} +{{- $.Scratch.Set "comments" false }} +{{- end }} +{{- if and (isset .Params "commentable") (eq .Params.commentable false) }} +{{- $.Scratch.Set "comments" false -}} +{{- else if and (isset .Params "commentable") (eq .Params.commentable true) }} +{{- $.Scratch.Set "comments" true }} +{{- end }} +{{- if eq ($.Scratch.Get "comments") true }} +{{- partial "comments.html" . }} +{{- end }} +{{- end }} </div> {{- end }} |