Update with custom theme files

This commit is contained in:
Ben Goldsworthy 2022-11-10 22:48:02 -07:00
parent 3b303aee07
commit 0c277c2458
45 changed files with 4324 additions and 11 deletions

View file

@ -0,0 +1,12 @@
{{ "<!--" | safeHTML }}
{{ .Site.Title}} - {{ .Site.Params.tagline }}
Written in {{ now.Format "2006" }} by {{ .Site.Author.name }} <{{ .Site.Author.email }}>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along
with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
{{ "-->" | safeHTML }}

View file

@ -0,0 +1,8 @@
<!--. is .c-->
<!--$ is .g-->
{{ $scratch := .g.Scratch }}
{{ with ( where ( where .g.Site.Pages "Type" "organisations" ) "Params.parent" .g.File.ContentBaseName ) }}
{{ $scratch.Add "children" ( slice . ) }}
{{ partial "cv/organisations/recursive-children.html" (dict "c" . "g" $.g ) }}
{{ end }}

View file

@ -0,0 +1,26 @@
{{ if gt ( len .content ) 4 }}
<details id="posts" class="org-items row">
<summary>
<h2 class="subheading">{{ .section_title }} ({{ len .content }})</h2>
<div class="index">
{{ range first 4 .content }}
{{ partial "item-tile.html" . }}
{{ end }}
</div>
</summary>
<div class="index">
{{ range after 4 .content }}
{{ partial "item-tile.html" . }}
{{ end }}
</div>
</details>
{{ else }}
<div id="posts" class="org-items row">
<h2 class="subheading">{{ .section_title }} ({{ len .content }})</h2>
<div class="index">
{{ range first 4 .content }}
{{ partial "item-tile.html" . }}
{{ end }}
</div>
</div>
{{ end }}

View file

@ -0,0 +1,11 @@
{{ $titles := ( slice )}}
{{ range . }}
{{ $titles = $titles | append (slice (.Title | plainify) )}}
{{ with .Sections }}
{{ $titles = $titles | append ( partial "cv/organisations/recursive-children-titles.html" . ) }}
{{ end }}
{{ end }}
{{ return $titles }}

View file

@ -0,0 +1,5 @@
<li class="hierarchy-item hierarchy-item--child"><a href="{{ .RelPermalink }}">{{ .Title | safeHTML }}</a>
{{ range .Sections }}<ul>
{{ partial "cv/organisations/recursive-children.html" . }}
</ul>{{ end }}
</li>

View file

@ -0,0 +1,12 @@
<!--. is .c-->
<!--$ is .g-->
{{ $scratch := .g.Scratch }}
{{ if .c.Parent }}
{{ if ne .c.Parent.Type "cv/organisations" }}
{{ with .c.Parent }}
{{ $scratch.Add "parents" ( slice . ) }}
{{ partial "cv/organisations/recursive-parents.html" (dict "c" . "g" $.g ) }}
{{ end }}
{{ end }}
{{ end }}

View file

@ -0,0 +1,7 @@
{{ $organisations := slice }}
{{ range .Site.Pages }}
{{ if .IsDescendant ( .GetPage "cv/organisations" ) }}
{{ $organisations = $organisations | append . }}
{{ end }}
{{ end }}
{{ return $organisations }}

View file

@ -0,0 +1,5 @@
<div class="item-tile item-tile--heading" id="items-{{ .Key }}">
<header class="item-tile__header">
<h2 class="item-tile__title">{{ .Key }}</h1>
</header>
</div>

View file

@ -0,0 +1,8 @@
<header class="site-header">
{{ block "header" . }}
<h1 class="site-header__title" itemprop="name"><a href="{{ .Site.Home.RelPermalink }}">{{ .Site.Title }}</a></h1>
<p class="site-header__tagline" itemprop="about">Views my own. Discussion ≠ endorsement. Do try this at home.</p>
<p class="site-header__icons">~ <a href="mailto:{{ $.Site.Author.email }}" rel="me">&#128231;</a> ~ <a href="{{ .Site.Params.codeURL }}">&#128187;</a> ~ <a href="/{{ .Site.Params.keyfile }}">&#128272;</a> ~ <a href="/index.xml"><img class="feed-icon" src="/images/feed-icon.png"></a> ~</p>
{{ partial "header/site-nav.html" . }}
{{ end }}
</header>

View file

@ -0,0 +1,7 @@
<nav class="site-header__nav">
<ul>
{{ range ( where .Site.Sections.ByTitle "Type" "in" site.Params.mainSections ) }}
<a href="{{ .RelPermalink }}"><li>{{ .Title | safeHTML }}</li></a>
{{ end }}
</ul>
</nav>

View file

@ -0,0 +1,29 @@
<a id="{{ .Slug }}" class="link--tile" href="{{ .RelPermalink }}" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
<article class="item-tile lazy {{- with .Params.site }} item-tile--{{ . }}{{ end -}}"
{{ if .Params.featured_image }}
{{ if .Resources.GetMatch .Params.featured_image }}
style="background-image: url({{ ( .Resources.GetMatch .Params.featured_image ).RelPermalink }})"
{{ else }}
style="background-image: url({{ .Params.featured_image }})"
{{ end }}
{{ end }}
>
<header class="item-tile__header">
{{ if ( or .Params.series .Params.published_in ) }}
<span class="item-tile__banner item-tile__banner--{{ if .Params.series }}series{{ else if .Params.published_in }}published-in{{ end}}">
{{- if .Params.series -}}
{{ .Params.series | safeHTML }}
{{- else if .Params.published_in -}}
{{ .Params.published_in | safeHTML }}
{{- end -}}
</span>
{{ end }}
<h1 class="item-tile__title{{ if gt ( len ( .Title | plainify ) ) 40 }} item-tile__title--long{{ end }}" itemprop="name">
<span role="text">{{ .Title | safeHTML }}</span>
</h1>
{{ with .Params.subtitle }}
<p class="item-tile__subtitle">{{ . | safeHTML }}</p>
{{ end }}
</header>
</article>
</a>

View file

@ -0,0 +1,8 @@
<section class="site-content__body">
{{ range ( ( where .Pages "Draft" false ).GroupByPublishDate "2006" ) }}
{{ partial "header-tile.html" . }}
{{ range .Pages }}
{{ partial "item-tile.html" . }}
{{ end }}
{{ end }}
</section>

View file

@ -0,0 +1,32 @@
<section class="site-content__body">
<table class="organisations-table">
<thead>
<tr>
<th>Logo</th>
<th>Title</th>
<th>Children</th>
<th>Items</th>
</tr>
</thead>
<tbody>
{{ range .Pages }}
<tr>
<td>
{{- if .Params.featured_image -}}
<img width="150" height="auto" loading="lazy" src="
{{- if .Resources.GetMatch .Params.featured_image -}}
{{- ( .Resources.GetMatch .Params.featured_image ).RelPermalink -}}
{{- else -}}
{{- .Params.featured_image -}}
{{- end -}}
">
{{- end -}}
</td>
<td><a href="{{ .RelPermalink }}">{{ .Title | safeHTML }}</a></td>
<td>{{- if gt (len .Sections) 0 -}}&#10004;{{- end -}}</td>
<td></td>
</tr>
{{ end }}
</tbody>
</table>
</section>

View file

@ -0,0 +1,82 @@
<footer class="site-content__footer">
<h1>Meta</h1>
{{- if .GetTerms "categories" -}}
<section id="post-categories" class="article-footer__categories" aria-labelledby="post-categories-title">
<h2 id="post-categories-title">Categories</h2>
<ul>
{{- range (.GetTerms "categories") -}}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
{{- end -}}
</ul>
</section>
{{- end -}}
{{- with .Params.internal_links -}}
<section class="article-footer__links">
<h2>Internal Links</h2>
<ul>
{{- range . -}}
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
<li><a href="{{ .link }}">{{ .title | safeHTML }}</a></li>
{{ else }}
<li><a href="{{ . }}">Link</a></li>
{{ end }}
{{- end -}}
</ul>
</section>
{{- end -}}
{{- with .Params.external_links -}}
<section class="article-footer__links">
<h2>External Links</h2>
<ul>
{{- range . -}}
{{ if eq ( printf "%T" . ) "map[string]interface {}" }}
<li><a href="{{ .link }}" rel="noopener noreferrer" target="_blank">{{ .title | safeHTML }}</a></li>
{{ else }}
<li><a href="{{ . }}" rel="noopener noreferrer" target="_blank">Link</a></li>
{{ end }}
{{- end -}}
</ul>
</section>
{{- end -}}
{{- if .GetTerms "organisations" -}}
<section id="post-organisations" class="article-footer__organisations" aria-labelledby="post-organisations-title">
<h2 id="post-organisations-title">Organisations</h2>
<ul>
{{ $all_organisations := partialCached "get_all_organisations.html" . }}
<!-- TODO: Replace with hierarchy partial -->
{{- range ( .GetTerms "organisations" ) -}}
{{ with ( where $all_organisations "Title" ( .Title | plainify ) ) }}
{{ range . }}
<li><a href="{{ .RelPermalink }}">{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</a></li>
{{ end }}
{{ else }}
{{ warnf "Could not find organisation %q (%q)" .Title $.File.Path }}
<li>{{ if ( .Params.markup_title ) }}{{ .Params.markup_title | safeHTML }}{{ else }}{{ .Title }}{{ end }}</li>
{{ end }}
{{- end -}}
</ul>
</section>
{{- end -}}
{{- if .GetTerms "locations" -}}
<section id="post-locations" class="article-footer__locations" aria-labelledby="post-locations-title">
<h2 id="post-locations-title">Locations</h2>
<div id="mapdiv" style="width: 100%; height: 500px; margin: 0; display: block;"></div>
</section>
{{- end -}}
{{- if .GetTerms "tags" -}}
<section id="post-tags" class="article-footer__tags" aria-labelledby="post-tags-title">
<h2 id="post-tags-title">Tags</h2>
<ul>
{{- range ( .GetTerms "tags" ).ByTitle -}}
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle | safeHTML }}</a></li>
{{- end -}}
</ul>
</section>
{{- end -}}
</footer>

View file

@ -0,0 +1,9 @@
<!-- Source: https://discourse.gohugo.io/t/reverse-array/28753/2 -->
{{- $sliceOriginal := . -}}
{{- $len := len $sliceOriginal -}}
{{- $sliceReversed := slice -}}
{{- range seq $len -}}
{{- $sliceReversed = $sliceReversed | append (index $sliceOriginal (sub $len .)) }}
{{- end -}}
{{- return $sliceReversed -}}

View file

@ -0,0 +1,5 @@
<ul class="minor-links__years">
{{ range ( ( where .Pages "Draft" false ).GroupByDate "2006" ) }}
<li><a href="#items-{{ .Key }}">{{ .Key }}</a></li>
{{ end }}
</ul>