convert into Hugo module theme

This commit is contained in:
Ben Goldsworthy 2025-01-04 20:22:41 +01:00
parent b07a2a6cf5
commit 04abc92ae5
Signed by: Rumperuu
SSH key fingerprint: SHA256:e5XfzNOr9UvWpEzyLfw0GtTMZWIFh3NmxH+/qQIi3xE
98 changed files with 2137 additions and 15971 deletions

View file

@ -1,64 +0,0 @@
{{ define "title" }}
CV by Location | {{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--section location-map{{ end }}
{{ define "header-scripts" }}
<link rel="stylesheet" href="/css/leaflet.css"/>
{{ end }}
{{ define "footer-scripts" }}
<script src="/js/leaflet.js"></script>
<script src="/js/leaflet-heat.js"></script>
<script>
var map = L.map('map').setView([55, -3], 3);
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
{{- range $.Site.Data.locations -}}
/* L.marker([{{ .lat }}, {{ .lon }}]).addTo(map); */
{{- end -}}
L.heatLayer(
[
{{- range .Site.AllPages -}}
{{- with .Params.locations -}}
{{- range . -}}
{{- with ( index $.Site.Data.locations . ) -}}
[ {{ .lat }}, {{ .lon }} ],
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
],
{
minOpacity: 0.5,
gradient: {0.2: 'blue', 0.5: 'lime', 1: 'red'}
}
).addTo(map);
</script>
{{ end }}
{{ define "main-header" }}
<header class="site-content__header">
<h1 class="page-title">{{ .Title | safeHTML }}.</h1>
{{ .Content }}
</header>
{{ end }}
{{ define "main-body" }}
<article class="site-content__body site-content__body--chart">
<div id="map" style="width: 100%; height: 500px; margin: 0; display: block;"></div>
<ul style="grid-area: section-content">
{{- range $key, $value := $.Site.Data.locations -}}
<li itemscope itemtype="https://schema.org/Place">{{ $key }}</li>
{{- end -}}
</ul>
</article>
{{ end }}

View file

@ -110,7 +110,7 @@
}
</script>
{{- else -}}
{{ $js := resources.Get "js/roles-chart.js" | resources.ExecuteAsTemplate "/js/render-roles-timeline.js" ( .GetPage "cv/roles" ) | resources.Fingerprint }}
{{ $js := resources.Get "js/roles-chart.gojs" | resources.ExecuteAsTemplate "/js/render-roles-timeline.js" ( .GetPage "cv/roles" ) | resources.Fingerprint }}
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}"></script>
{{- end -}}
{{ end }}

View file

@ -1,38 +0,0 @@
{{- $itemType := default "CreativeWork" ( .Params.schemaType ) -}}
{{- if ( or ( in $.Site.Data.itemtypes $itemType ) ( eq .Params.suppress "true" ) ) -}}
{{- with .Params.href -}}
<a href="{{ if eq . "asCite" }}{{ $.Params.cite }}{{ else }}{{ . }}{{ end }}">
{{- end -}}
<cite
class="cite{{ with .Params.citeStyle }} cite--{{ . }}{{ end }}"
itemscope
itemprop="citation"
itemtype="https://schema.org/{{- $itemType -}}"
{{- if .Params.titleLang -}}
lang="{{- .Params.titleLang -}}"
title="{{- .Params.titleTr -}}"
{{- end -}}>
{{- with .Params.cite -}}
<meta itemprop="url" content="{{ . }}">
{{- end -}}
<span itemprop="name">
{{- if .Params.titleLang -}}
<i lang="{{ .Params.titleLang }}" title="{{ .Params.titleTr }}">
{{- end -}}
{{- if .Params.shortTitle -}}
{{- .Params.shortTitle | markdownify | safeHTML -}}
{{- else -}}
{{- .Params.title | markdownify | safeHTML -}}
{{- end -}}
{{- if .Params.titleLang -}}
</i>
{{- end -}}
</span>{{- /**/ -}}
</cite>
{{- with .Params.href -}}
</a>
{{- end -}}
{{- else -}}
{{- erroridf "invalid-schema-type" "Invalid Schema.org type value %q for %q" $itemType .Params.title -}}
{{- end -}}

View file

@ -1,52 +0,0 @@
<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 -}}
{{- if ( not ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) ) -}}
<tr>
<td>
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
{{- if ( eq $.Site.Params.redact "black" ) -}}
{{- partialCached "redact-black.html" . -}}
{{- end -}}
{{- else -}}
{{- if .Params.featured_image -}}
<img class="organisation-table__logo" loading="lazy" src="
{{- if .Resources.GetMatch .Params.featured_image -}}
{{- ( .Resources.GetMatch .Params.featured_image ).RelPermalink -}}
{{- else -}}
{{- .Params.featured_image -}}
{{- end -}}
">
{{- end -}}
{{- end -}}
</td>
<td>
{{- if ( and ( .Params.redact ) ( ne $.Site.Params.redact "show" ) ) -}}
{{- if ( eq $.Site.Params.redact "black" ) -}}
{{- partialCached "redact-black.html" . -}}
{{- end -}}
{{- else -}}
<a href="{{ .RelPermalink }}">
{{- if .Params.TitleLang -}}<i lang="{{ .Params.TitleLang }}" title="{{ .Params.TitleTrans }}"}>{{- end -}}
{{- with .Params.markup_title -}}{{- . | safeHTML -}}{{- else -}}{{- .Title | safeHTML -}}{{- end -}}
{{- if .Params.TitleLang -}}</i>{{- end -}}
</a>
{{- end -}}
</td>
<td>{{- if gt (len .Sections) 0 -}}&#10004;{{- end -}}</td>
<td></td>
</tr>
{{- end -}}
{{- end -}}
</tbody>
</table>
</section>

View file

@ -1,26 +0,0 @@
{{ if gt ( len .content ) 4 }}
<details id="{{ .section_title | anchorize }}" 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="{{ .section_title | anchorize }}" 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

@ -1,16 +0,0 @@
<aside class="timeline__legend">
<div>
<label for="legend__past">Past</label>
<div id="legend__past">
<button id="past-unpaid" class="legend__button"><p><span class="colour-square colour-square--unpaid-past"></span> Unpaid</p></button>
<button id="past-paid" class="legend__button"><p><span class="colour-square colour-square--paid-past"></span> Paid</p></button>
</div>
</div>
<div>
<label for="legend__current">Current</label>
<div id="legend__current">
<button id="current-unpaid" class="legend__button"><p><span class="colour-square colour-square--unpaid-current"></span> Unpaid</p></button>
<button id="current-paid" class="legend__button"><p><span class="colour-square colour-square--paid-current"></span> Paid</p></button>
</div>
</div>
</aside>

View file

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

View file

@ -1,11 +0,0 @@
<!--
Given a top-level section title slug [blog|cv|portfolio], returns all
`Pages` within that top-level section.
@param sc The site content (`$`)
@param section_slug The slug of the section to use [blog|cv|portfolio]
@returns Pages|nil
-->
{{- where ( ( .sc.GetPage "cv" ).Sections ) "Title" .section_title -}}

View file

@ -1,81 +0,0 @@
<figure class="figure--gallery gallery" itemscope itemtype="http://schema.org/ImageGallery">
{{- if or ( .Get "caption" ) ( .Get "title" ) -}}
<figcaption class="figure__caption gallery__caption{{ if not ( or ( .Get "caption" ) ( .Get "title" ) ) }} figure__caption--no-height{{ end }}">
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}}
{{- with .Get "caption" -}}
<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>
{{- end -}}
</figcaption>
{{- end -}}
{{- with (.Get "dir") -}}
<!-- If a directory was specified, generate figures for all of the images in the directory -->
{{- $images := $.Page.Resources.Match ( print . "/*" ) }}
{{- range $images -}}
{{- $caption := .Name | replaceRE "\\..*" "" | humanize }}<!-- humanized filename without extension -->
{{- $linkURL := print $.Page.Permalink ($.Get "dir") "/" .Name | absURL }}<!-- absolute URL to hi-res image -->
<figure class="figure gallery__figure" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<a href="{{ .RelPermalink }}" itemprop="contentUrl">
<picture class="figure__picture"
itemprop="image">
<img itemprop="thumbnail"
class="u-photo gallery__thumbnail"
{{ if ( or ( eq .MediaType.SubType "svg" ) ( eq .MediaType.SubType "gif" ) ) }}
src="{{ .RelPermalink }}"
{{ else }}
{{ with .Resize "600x webp" }}
src="{{ .RelPermalink }}"
{{ end }}
width="{{ .Width }}"
height="{{ .Height }}"
{{ end }}
{{- with .Params.alt }}
alt="{{ . }}"
{{- end -}}
{{- with .Params.title }} title="{{ . }}" {{ end -}}
loading="lazy"
>
</picture>
</a>
{{- if or ( .Params.title ) ( .Params.attr ) -}}
<figcaption class="figure__caption{{ if not .Params.title }} figure__caption--no-height{{ end }}">
{{ if .Params.attrlink -}}
<a class="figcaption__attrlink" href="{{ .Params.attrlink }}"
{{- with .Params.attrtarget }} target="{{ . }}"{{ end -}}
{{- with .Params.attrrel }} rel="{{ . }}"{{ end -}}
>
{{- end -}}
{{- if .Params.attr -}}<p class="figcaption__attr">{{ .Params.attr | safeHTML }}{{ with .Params.attrlicence }} <span class="figcaption__licence">{{ . | safeHTML }}</span>{{ end }}</p>{{- end -}}
{{- if .Params.attrlink -}}
</a>
{{- end -}}
{{- if .Params.href -}}
<a href="{{- if ( eq .Params.href "asCite" ) -}}{{ .Params.cite }}{{- else -}}{{ .Params.href }}{{- end -}}">
{{- end -}}
{{- if .Params.title -}}
<h5 class="figcaption__title">
{{- if .Params.titleLang -}}
<i lang="{{ .Params.titleLang }}" title="{{ .Params.titleTr }}">
{{- end -}}
{{ .Params.title | safeHTML }}
{{- if .Params.titleLang -}}
</i>
{{- end -}}
</h5>
{{- else -}}
{{- with .Params.href -}}
<p class="figcaption__title">Link</p>
{{- end -}}
{{- end -}}
{{- if .Params.href -}}
</a>
{{- end -}}
</figcaption>
{{- end -}}
</figure>
{{- end }}
{{- else -}}
<!-- If no directory was specified, include any figure shortcodes called within the gallery -->
{{ .Inner }}
{{- end }}
</figure>