update layouts: draft tag; remove redundant code

This commit is contained in:
loikein 2023-05-25 12:03:42 +01:00
parent 1dc5f0c3d3
commit 46406fda64
5 changed files with 21 additions and 25 deletions

View file

@ -14,26 +14,21 @@
<section class="list-page"> <section class="list-page">
<!-- preambles --> <!-- preambles -->
{{- if .RegularPages -}}
<ul> <ul>
{{ range .Pages.ByTitle }} {{ range .RegularPages.ByTitle -}}
{{ if .IsPage }} <li><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}}&nbsp;:: Draft{{- end -}}</a></li>
<li><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}} :: Draft {{- end -}}</a></li> {{ end -}}
{{ end }}
{{ end }}
</ul> </ul>
{{- end -}}
<!-- sub categories & pages --> <!-- sub categories & pages -->
{{ $indexScratch := .Scratch }} {{- range .Sections.ByTitle -}}
{{ range .Sections }} <p><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}}&nbsp;:: Draft{{- end -}}</a></p>
{{ $indexScratch.Add "sections" (slice . ) }}
{{ end }}
{{- range ($indexScratch.Get "sections").ByTitle -}}
<p><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}} :: Draft {{- end -}}</a></p>
<ul> <ul>
{{- range .Pages.ByTitle -}} {{- range .RegularPages.ByTitle -}}
<li><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}} :: Draft {{- end -}}</a></li> <li><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}}&nbsp;:: Draft{{- end -}}</a></li>
{{- end -}} {{- end -}}
</ul> </ul>
{{- end -}} {{- end -}}

View file

@ -15,7 +15,7 @@
<ul> <ul>
{{ range .Pages.ByTitle }} {{ range .Pages.ByTitle }}
{{ if .IsPage }} {{ if .IsPage }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}} :: Draft {{- end -}}</a></li> <li><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}}&nbsp;:: Draft{{- end -}}</a></li>
{{ end }} {{ end }}
{{ end }} {{ end }}
</ul> </ul>

View file

@ -15,23 +15,24 @@
<!-- preambles --> <!-- preambles -->
{{- if .RegularPages -}}
<ul> <ul>
{{ range .Pages.ByTitle }} {{ range .RegularPages.ByTitle }}
{{ if .IsPage }} <li><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}}&nbsp;:: Draft{{- end -}}</a></li>
<li><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}} :: Draft {{- end -}}</a></li>
{{ end }}
{{ end }} {{ end }}
</ul> </ul>
{{- end -}}
<!-- sub categories --> <!-- sub categories -->
{{- if .Sections -}}
<ul> <ul>
{{ range .Pages.ByTitle }} {{ range .Sections.ByTitle }}
{{ if .IsSection }} <li><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}}&nbsp;:: Draft{{- end -}}</a></li>
<li><a href="{{ .RelPermalink }}">{{ .Title }}{{- if .Draft -}} :: Draft {{- end -}}</a></li>
{{ end }}
{{ end }} {{ end }}
</ul> </ul>
{{- end -}}
</section> </section>
{{ partial "footer.html" . }} {{ partial "footer.html" . }}

View file

@ -15,7 +15,7 @@
{{ if .IsNode }} {{ if .IsNode }}
<a href="{{ .Permalink }}">{{ .Title}}</a> <a href="{{ .Permalink }}">{{ .Title}}</a>
{{ else }} {{ else }}
<a href="{{ .RelPermalink }}">{{ .Title }}{{ if .Draft }} :: Draft {{end}}</a> <a href="{{ .RelPermalink }}">{{ .Title }}{{ if .Draft }}&nbsp;:: Draft{{end}}</a>
{{ end }} {{ end }}
</h2> </h2>

View file

@ -1,6 +1,6 @@
<section> <section>
<h1 class="content-title"> <h1 class="content-title">
{{- .Title -}}{{- if .Draft -}} :: Draft {{- end -}} {{- .Title -}}{{- if .Draft -}}&nbsp;:: Draft{{- end -}}
</h1> </h1>
{{- if .Params.subtitle -}} {{- if .Params.subtitle -}}
<p class=subtitle>{{ .Params.subtitle }}</p> <p class=subtitle>{{ .Params.subtitle }}</p>