Use indentation inside templating blocks for better readability

This commit is contained in:
BBaoVanC 2021-11-22 02:21:15 -06:00
parent e1e211a42a
commit ead88d5e16
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
24 changed files with 310 additions and 326 deletions

View File

@ -1,5 +1,4 @@
{{ define "main" }} {{ define "main" }}
<h1> <h1>
{{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }} {{ with .Params.icon }}{{ partial "icon.html" . }}{{ end }}
{{ .Title | markdownify }} {{ .Title | markdownify }}
@ -33,5 +32,4 @@
</div> </div>
{{ partial "pagination.html" . }} {{ partial "pagination.html" . }}
{{ end }} {{ end }}

View File

@ -8,9 +8,7 @@
{{ partial "post-metadata/full.html" . }} {{ partial "post-metadata/full.html" . }}
{{ with (.GetTerms "series") }} {{ with (.GetTerms "series") }}
{{ $series := slice }} {{ $series := slice }}
{{ range . }} {{ range . }}
{{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }} {{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
@ -26,7 +24,6 @@
{{ delimit $series ", " }} {{ delimit $series ", " }}
</div> </div>
{{ end }} {{ end }}
@ -102,5 +99,4 @@
{{ partial "comments.html" . }} {{ partial "comments.html" . }}
</div> </div>
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -5,8 +5,8 @@
{{ else }} {{ else }}
<figure class="border"> <figure class="border">
{{ end }} {{ end }}
{{ with index . "src" }}
{{ with index . "src" }}
{{ $media := . }} {{ $media := . }}
{{ if eq .MediaType.MainType "image" }} {{ if eq .MediaType.MainType "image" }}
<img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" /> <img src="{{ $media.Permalink }}" alt="{{ $media.Title }}" />
@ -24,6 +24,5 @@
</figcaption> </figcaption>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }} {{ end }}
</figure> </figure>

View File

@ -3,17 +3,14 @@
{{ partial "icon.html" "user-circle" }} {{ partial "icon.html" "user-circle" }}
{{ if index $.Site.Taxonomies "authors" }} {{ if index $.Site.Taxonomies "authors" }}
{{ $authors := slice }} {{ $authors := slice }}
{{ range . }} {{ range . }}
{{ $url := (printf "authors/%s" (. | anchorize)) | absLangURL }} {{ $url := (printf "authors/%s" (. | anchorize)) | absLangURL }}
{{ $authors = $authors | append (printf `<a href="%s">%s</a>` $url . | safeHTML) }} {{ $authors = $authors | append (printf `<a href="%s">%s</a>` $url . | safeHTML) }}
{{ end }} {{ end }}
{{ delimit $authors ", " }} {{ delimit $authors ", " }}
{{ else }} {{ else }}
{{ delimit . ", " }} {{ delimit . ", " }}
{{ end }} {{ end }}
</span> </span>
{{ end }} {{ end }}

View File

@ -1,5 +1,4 @@
{{ with (.GetTerms "series") }} {{ with (.GetTerms "series") }}
{{ $series := slice }} {{ $series := slice }}
{{ range . }} {{ range . }}
{{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }} {{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}

View File

@ -1,5 +1,4 @@
{{ with (.GetTerms "tags") }} {{ with (.GetTerms "tags") }}
{{ $tags := slice }} {{ $tags := slice }}
{{ range . }} {{ range . }}
{{ $tags = $tags | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }} {{ $tags = $tags | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}

View File

@ -8,6 +8,7 @@
{{ else }} {{ else }}
<figure> <figure>
{{ end }} {{ end }}
{{ if eq $type "image" }} {{ if eq $type "image" }}
<img src="{{ $src }}" alt="{{ $alt }}" /> <img src="{{ $src }}" alt="{{ $alt }}" />
{{ else if eq $type "video" }} {{ else if eq $type "video" }}

View File

@ -1,9 +1,7 @@
{{ with .Params.authors }} {{ with .Params.authors }}
<meta name="author" content="{{ delimit . ", " }}"> <meta name="author" content="{{ delimit . ", " }}">
{{ range . }} {{ range . }}
<meta property="article:author" content="{{ . }}"> <meta property="article:author" content="{{ . }}">
{{ end }} {{ end }}
{{ end }} {{ end }}

View File

@ -9,14 +9,11 @@
{{ end }} {{ end }}
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}
{{ $isActive := false }} {{ $isActive := false }}
{{ if or ($.HasMenuCurrent .Menu .) ($.IsMenuCurrent .Menu .) }} {{ if or ($.HasMenuCurrent .Menu .) ($.IsMenuCurrent .Menu .) }}
{{ $isActive = true }} {{ $isActive = true }}
{{ end }} {{ end }}
<a class="navbar-item{{ if $isActive }} active{{ end }}" href="{{ .URL }}">{{ .Name }}</a> <a class="navbar-item{{ if $isActive }} active{{ end }}" href="{{ .URL }}">{{ .Name }}</a>
{{ end }} {{ end }}
</nav> </nav>