Move footer tags list to a partial so photos and blogs can use the same template
Simplify the blog post layout by removing the <article> tag
This commit is contained in:
parent
c5427866c6
commit
ecb39a9298
5 changed files with 100 additions and 94 deletions
24
layouts/partials/footer_tags.html
Normal file
24
layouts/partials/footer_tags.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
{{- if or .Params.categories .Params.tags -}}
|
||||
<ul class="tags">
|
||||
{{- if .Params.categories -}}
|
||||
{{- $categories := .GetTerms "categories" -}}
|
||||
{{- if gt (len $categories) 1 -}}
|
||||
{{- errorf "More than one category for %q" .Path -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- with index (.GetTerms "categories") 0 -}}
|
||||
<li class="category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and .Params.categories .Params.tags -}}
|
||||
<li class="chevron noselect">⏵</li>
|
||||
{{- end -}}
|
||||
|
||||
{{- if .Params.tags -}}
|
||||
{{- range .GetTerms "tags" -}}
|
||||
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{- end -}}
|
|
@ -1,4 +1,3 @@
|
|||
<article class="post-single">
|
||||
<header>
|
||||
{{ partial "development/draft_tag.html" . }}
|
||||
<div class="post-title">
|
||||
|
@ -13,39 +12,18 @@
|
|||
{{ .Content }}
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
{{- if or .Params.categories .Params.tags -}}
|
||||
<ul class="tags">
|
||||
{{- if .Params.categories -}}
|
||||
{{- $categories := .GetTerms "categories" -}}
|
||||
{{- if gt (len $categories) 1 -}}
|
||||
{{- errorf "More than one category for %q" .Path -}}
|
||||
{{- end -}}
|
||||
{{- with index (.GetTerms "categories") 0 -}}
|
||||
<li class="category"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- if and .Params.categories .Params.tags -}}
|
||||
<li class="chevron noselect">⏵</li>
|
||||
{{- end -}}
|
||||
{{- if .Params.tags -}}
|
||||
{{- range .GetTerms "tags" -}}
|
||||
<li><a href="{{ .Permalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
{{- end -}}
|
||||
<footer>
|
||||
{{ partial "footer_tags.html" . }}
|
||||
|
||||
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||
{{ if and (gt (len $pages) 1) (in $pages . ) }}
|
||||
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
|
||||
{{- if and (gt (len $pages) 1) (in $pages . ) -}}
|
||||
<nav class="post-nav">
|
||||
{{ with $pages.Prev . }}
|
||||
<a class="prev" href="{{ .Permalink }}"><span>←</span><span>{{ .Name }}</span></a>
|
||||
<a class="prev" href="{{ .Permalink }}"><span>←</span><span>{{ .Name }}</span></a>
|
||||
{{ end }}
|
||||
{{ with $pages.Next . }}
|
||||
<a class="next" href="{{ .Permalink }}"><span>{{ .Name }}</span><span>→</span></a>
|
||||
<a class="next" href="{{ .Permalink }}"><span>{{ .Name }}</span><span>→</span></a>
|
||||
{{ end }}
|
||||
</nav>
|
||||
{{ end }}
|
||||
</footer>
|
||||
</article>
|
||||
{{- end -}}
|
||||
</footer>
|
||||
|
|
|
@ -40,6 +40,10 @@
|
|||
</ul>
|
||||
</figure>
|
||||
{{ end }}
|
||||
|
||||
<footer>
|
||||
{{ partial "footer_tags.html" . }}
|
||||
</footer>
|
||||
{{ end }}
|
||||
|
||||
{{ define "footer" }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue