brainbaking/themes/brainbaking-minimal/layouts/_default/terms.html

55 lines
1.5 KiB
HTML

{{ partial "header" . }}
{{ partial "bigimg" . }}
<main class="list">
<header>
<h1>
<svg class='icon'><use xlink:href="#{{ .Params.icontag }}"></use></svg>&nbsp;{{ .Title }}
</h1>
</header>
<hr/>
{{ with .Content }}
<article>
{{ . }}
</article>
{{ end }}
<article>
<div class="list">
<!-- https://discourse.gohugo.io/t/lists-of-content-divided-by-posts-first-letter/8534/2 - create a list with all uppercase letters -->
{{ $letters := split "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "" }}
<!-- range all pages sorted by their title -->
{{ range .Data.Pages.ByTitle }}
<!-- get the first character of each title. Assumes that the title is never empty! -->
{{ $firstChar := substr .Title 0 1 | upper }}
<!-- in case $firstChar is a letter -->
{{ if $firstChar | in $letters }}
<!-- get the current letter -->
{{ $curLetter := $.Scratch.Get "curLetter" }}
<!-- if $curLetter isn't set or the letter has changed -->
{{ if ne $firstChar $curLetter }}
<!-- update the current letter and print it -->
</span></li></ul><div style="clear: both;"></div>
{{ $.Scratch.Set "curLetter" $firstChar }}
<h3>{{ $firstChar }}</h3>
<ul class="list-ul" style="padding-top: 1rem"><li><span class='list-tags'>
{{ end }}
<a href="{{ .RelPermalink }}"><kbd class="item-tag">{{ .Title }}</kbd></a>
{{ end }}
{{ end }}
</div>
</article>
</main>
{{ partial "footer" . }}