update theme

This commit is contained in:
Ben Goldsworthy 2023-08-22 11:14:33 +01:00
parent 920db1a5ce
commit 43ddb22f80
17 changed files with 1462 additions and 207 deletions

File diff suppressed because it is too large Load Diff

View File

@ -16,21 +16,21 @@ function drawChart() {
"Member",
"#BBBBB0",
new Date("2023-07-12"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Online Safety SIG",
"Member",
"#BBBBB0",
new Date("2023-07-12"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Youth Standing Group",
"Member",
"#BBBBB0",
new Date("2023-07-12"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Centro de Derechos Humanos Fray Bartolomé de las Casas, La Organización Sociedad Civil Las Abejas de Acteal",
@ -58,14 +58,14 @@ function drawChart() {
"Workawayer",
"#BBBBB0",
new Date("2023-03-26"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Cuba Solidarity Campaign",
"Member",
"#BBBBB0",
new Date("2023-03-03"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Workaway, Hospedaje Wounaan",
@ -93,7 +93,7 @@ function drawChart() {
"Developer",
"#BBBBB0",
new Date("2023-01-19"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Workaway, Finca DeLaRey",
@ -317,7 +317,7 @@ function drawChart() {
"Supporter",
"#BBBBB0",
new Date("2022-01-14"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Actica Consulting",
@ -373,14 +373,14 @@ function drawChart() {
"Member",
"#BBBBB0",
new Date("2021-09-24"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Mountain Training Association",
"Trainee Member",
"#BBBBB0",
new Date("2021-08-24"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"North West Area Meeting",
@ -394,7 +394,7 @@ function drawChart() {
"Member",
"#BBBBB0",
new Date("2021-07-26"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Lancaster Quaker Meeting",
@ -485,7 +485,7 @@ function drawChart() {
"Member",
"#BBBBB0",
new Date("2020-09-29"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Executive Committee",
@ -506,7 +506,7 @@ function drawChart() {
"Website Content Manager",
"#BBBBB0",
new Date("2020-08-31"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Digital & Data Scout Active Support Unit",
@ -653,14 +653,14 @@ function drawChart() {
"Associate Member",
"#BBBBB0",
new Date("2019-04-01"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Youth Hostel Association",
"Company Member",
"#BBBBB0",
new Date("2019-02-20"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Friends of Lancaster Library",
@ -842,14 +842,14 @@ function drawChart() {
"Member",
"#BBBBB0",
new Date("2018-06-20"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"UK England Chapter",
"Member",
"#BBBBB0",
new Date("2018-06-13"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Community Networks SIG",
@ -863,14 +863,14 @@ function drawChart() {
"Member",
"#BBBBB0",
new Date("2018-06-06"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Internet Society",
"Member",
"#BBBBB0",
new Date("2018-06-04"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Mitigate Cyber",
@ -1059,7 +1059,7 @@ function drawChart() {
"Member",
"#BBBBB0",
new Date("2017-06-06"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Lonsdale District Scout Network, Scout Network",
@ -1122,7 +1122,7 @@ function drawChart() {
"Member",
"#BBBBB0",
new Date("2016-12-19"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Pendle College, Lancaster University Students' Union",
@ -1493,7 +1493,7 @@ function drawChart() {
"Librarian",
"#BBBBB0",
new Date("2013-05-01"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Patient Participation Group",
@ -1549,7 +1549,7 @@ function drawChart() {
"Minister",
"#BBBBB0",
new Date("2012-01-01"),
new Date("2023-08-07")
new Date("2023-08-21")
],
[
"Salvation Army",

View File

@ -9,7 +9,7 @@
<h2 class="page-title">{{ .Type | singularize }}: <q>{{ .Title | safeHTML }}</q>
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed">
<img class="feed-icon" alt="RSS icon" src="{{ $.Site.Params.feedIcon }}">
<img class="feed-icon" alt="RSS feed" src="{{ $.Site.Params.feedIcon }}">
</a>
{{ end }}
</h2>

View File

@ -13,7 +13,7 @@
<h2 class="page-title">{{ .Title | safeHTML }}
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed">
<img class="feed-icon" alt="RSS icon" src="{{ $.Site.Params.feedIcon }}">
<img class="feed-icon" alt="RSS feed" src="{{ $.Site.Params.feedIcon }}">
</a>
{{ end }}
</h2>

View File

@ -68,14 +68,14 @@
{{ with .GetPage "blog/posts" }}
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed">
<img class="feed-icon" alt="RSS icon" src="{{ $.Site.Params.feedIcon }}">
<img class="feed-icon" alt="RSS feed" src="{{ $.Site.Params.feedIcon }}">
</a>
{{ end }}
{{ end }}
{{ else }}
{{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed">
<img class="feed-icon" alt="RSS icon" src="{{ $.Site.Params.feedIcon }}">
<img class="feed-icon" alt="RSS feed" src="{{ $.Site.Params.feedIcon }}">
</a>
{{ end }}
{{ end }}

View File

@ -1,60 +1,60 @@
{{ define "title" }}
&ldquo;{{ .Title | plainify }}&rdquo; | {{ .Site.Title }}
&ldquo;{{ .Title | plainify }}&rdquo; | {{ .Site.Title }}
{{ end }}
{{ define "main-class" }}--single layouts-blog-single{{ end }}
{{ define "header-scripts" }}
{{ with .Params.locations }}
{{ $mapJS := resources.Get "js/leaflet.js" | fingerprint }}
<script id="Map-script" src="{{ $mapJS.Permalink }}" integrity="{{ $mapJS.Data.Integrity }}"></script>
{{ end }}
{{ with .Params.locations }}
{{ $mapJS := resources.Get "js/leaflet.js" | fingerprint }}
<script id="Map-script" src="{{ $mapJS.Permalink }}" integrity="{{ $mapJS.Data.Integrity }}"></script>
{{ end }}
{{ end }}
{{ define "header-styles" }}
{{ with .Params.styles }}
<link rel="stylesheet" type="text/css" href="{{ ( $.Page.Resources.GetMatch "style").RelPermalink }}">
{{ end }}
{{ with .Params.locations }}
<link rel="stylesheet" href="/css/leaflet.css">
{{ end }}
{{ with .Params.styles }}
<link rel="stylesheet" type="text/css" href="{{ ( $.Page.Resources.GetMatch "style").RelPermalink }}">
{{ end }}
{{ with .Params.locations }}
<link rel="stylesheet" href="/css/leaflet.css">
{{ end }}
{{ end }}
{{ define "footer-scripts" }}
{{ with .Params.locations }}
<script>
var map = L.map('map').setView([55, -3], 13);
{{ with .Params.locations }}
<script>
var map = L.map('map').setView([55, -3], 13);
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);
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);
var latLons = [];
{{ range . }}
{{ with ( index $.Site.Data.locations . ) }}
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
latLons.push([{{ .lat }}, {{ .lon }}]);
{{ else }}
{{ warnf "Could not find lat-lon for %q (%q)" . $.File.Path }}
{{ end }}
{{ end }}
map.fitBounds(latLons);
</script>
{{ end }}
{{ with .Params.scripts }}
{{ if in . "mathjax" }}
<script src="/js/polyfill.js"></script>
<script id="MathJax-script" async src="/js/mathjax/tex-chtml.js"></script>
<script src="/js/mathjax/config.js"></script>
{{ end }}
{{ if in . "charts" }}
{{ $chartsCoreJS := resources.Get "js/chart.js" | fingerprint }}
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" }}
<script id="Charts-script" src="{{ $chartsCoreJS.Permalink }}" integrity="{{ $chartsCoreJS.Data.Integrity }}"></script>
<script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}"></script>
{{ end }}
{{ end }}
var latLons = [];
{{ range . }}
{{ with ( index $.Site.Data.locations . ) }}
L.marker([{{ .lat }}, {{ .lon }}]).addTo(map);
latLons.push([{{ .lat }}, {{ .lon }}]);
{{ else }}
{{ warnf "Could not find lat-lon for %q (%q)" . $.File.Path }}
{{ end }}
{{ end }}
map.fitBounds(latLons);
</script>
{{ end }}
{{ with .Params.scripts }}
{{ if in . "mathjax" }}
<script src="/js/polyfill.js"></script>
<script id="MathJax-script" async src="/js/mathjax/tex-chtml.js"></script>
<script src="/js/mathjax/config.js"></script>
{{ end }}
{{ end }}
{{ if $.HasShortcode "chart" }}
{{ $chartsCoreJS := resources.Get "js/chart.js" | fingerprint }}
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" }}
<script id="Charts-script" src="{{ $chartsCoreJS.Permalink }}" integrity="{{ $chartsCoreJS.Data.Integrity }}"></script>
<script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}"></script>
{{ end }}
{{ end }}
{{ define "main-header" }}
@ -241,14 +241,23 @@
</section>
{{ end }}
{{ if fileExists ( path.Join $.Page.File.Dir "Corrigendum.md" ) }}
<section class="article-body__corrigendum">
{{ if fileExists ( path.Join $.Page.File.Dir "corrigendum.md" ) }}
<section class="article-body__corrigendum" itemprop="correction" itemscope itemtype="https://schema.org/CorrectionComment">
<h2 class="subheading subheading--corrigendum" id="corrigendum">Corrigendum</h2>
{{ $file := path.Join $.Page.File.Dir "corrigendum.md" | readFile }}
{{ $file | .RenderString }}
</section>
{{ end }}
</section>
{{ with .Page.Resources.Get "comments.md" }}
<section class="site-content__comments">
<h2 class="subheading subheading--comments" id="comments">Comments</h2>
<ul class="comment__thread">
{{ .RenderShortcodes }}
</il>
</section>
{{ end }}
{{ end }}
{{ define "main-footer" }}

View File

@ -1,6 +1,6 @@
{{- $itemType := default "CreativeWork" ( .Params.schemaType ) -}}
{{- if ( in $.Site.Data.itemtypes $itemType ) -}}
{{- if ( or ( in $.Site.Data.itemtypes $itemType ) ( eq .Params.suppress "true" ) ) -}}
{{- with .Params.href -}}
<a href="{{ if eq . "asCite" }}{{ $.Params.cite }}{{ else }}{{ . }}{{ end }}">
{{- end -}}
@ -34,5 +34,5 @@
</a>
{{- end -}}
{{- else -}}
{{- warnf "Invalid Schema.org type value: %q (%q)" $itemType .Page.File.Path -}}
{{- warnf "Invalid Schema.org type value %q for %q" $itemType .Params.title -}}
{{- end -}}

View File

@ -6,8 +6,8 @@
below.
Unless stated otherwise, and to the extent possible under law, the author has
dedicated all copyright and related and neighboring rights to this content to
the public domain worldwide. This file is distributed without any warranty.
dedicated all copyright and related and neighbouring rights to this content
to the public domain worldwide. This file is distributed without any warranty.
See <http://creativecommons.org/publicdomain/zero/1.0/> for
a copy of the CC0 Public Domain Dedication.

View File

@ -2,7 +2,7 @@
{{ block "header" . }}
<h2 class="p-name site-header__title" itemprop="name"><a class="u-url" href="{{ .Site.Home.RelPermalink }}" rel="me author">{{ .Site.Title }}</a></h2>
<p class="p-note site-header__tagline" itemprop="about">Views my own. Discussion ≠ endorsement. Do try this at home.</p>
<p class="site-header__icons">~ <a class="u-email" href="mailto:{{ $.Site.Author.email }}" rel="me">&#128231;</a> ~ <a class="u-url" href="{{ .Site.Params.codeURL }}" rel="me">&#128187;</a> ~ <a class="u-key" href="/{{ .Site.Params.keyfile }}" rel="me">&#128272;</a> ~ <a href="/index.xml" aria-label="{{ .Site.Title }} RSS feed"><img class="feed-icon" alt="RSS icon" src="{{ .Site.Params.feedIcon }}"></a> ~</p>
<p class="site-header__icons">~ <a class="u-email" href="mailto:{{ $.Site.Author.email }}" rel="me">&#128231;</a> ~ <a class="u-url" href="{{ .Site.Params.codeURL }}" rel="me">&#128187;</a> ~ <a class="u-key" href="/{{ .Site.Params.keyfile }}" rel="me">&#128272;</a> ~ <a href="/index.xml" aria-label="{{ .Site.Title }} RSS feed"><img class="feed-icon" alt="RSS feed" src="{{ .Site.Params.feedIcon }}"></a> ~</p>
{{ partial "header/site-nav.html" . }}
{{ end }}
</header>

View File

@ -3,7 +3,9 @@
{{ if ( not ( eq .Key "0001" ) ) }}
{{ partial "header-tile.html" . }}
{{ range .Pages }}
{{ partial "item-tile.html" . }}
{{ if ( not ( .IsDescendant ( .GetPage "/cv/roles" ) ) ) }}
{{ partial "item-tile.html" . }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}

View File

@ -1,13 +1,3 @@
{{ if fileExists ( path.Join $.Page.File.Dir "comments.md" ) }}
<!--<section id="comments">
<h2 class="subheading subheading--comments" id="comments">Comments</h2>
<ol>
{{ $file := path.Join $.Page.File.Dir "comments.md" | readFile }}
{{ $file | .RenderString }}
</ol>
</section>-->
{{ end }}
<footer class="site-content__footer">
<h2>Meta</h2>

View File

@ -6,11 +6,10 @@
class="figure--blockquote blockquote{{- if .Params.style }} blockquote--{{- .Params.style -}}{{- end -}}"
itemscope
itemtype="Quotation"
>
role="group">
<blockquote
class="blockquote__body"
{{- if .Params.cite }} cite="{{ .Params.cite }}"{{- end -}}
>
{{- if .Params.cite }} cite="{{ .Params.cite }}"{{- end -}}>
{{- .Inner | .Page.RenderString -}}
</blockquote>
<figcaption class="blockquote__caption">
@ -25,6 +24,7 @@
{{- .Scratch.SetInMap "Params" "titleTr" .Params.titleSeriesTr -}}
{{- .Scratch.SetInMap "Params" "cite" .Params.citeSeries -}}
{{- .Scratch.SetInMap "Params" "schemaType" .Params.schemaTypeSeries -}}
{{- .Scratch.SetInMap "Params" "suppress" "true" -}}
{{- .Scratch.SetInMap "parentCite" "Params" ( .Scratch.Get "Params" ) -}}
{{- partial "cite.html" ( .Scratch.Get "parentCite" ) -}}
{{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}}

View File

@ -0,0 +1,19 @@
<figure class="article__figure figure{{ with .Get "class" }} {{ . }}{{ end }}" role="group">
{{- with .Get "chart-id" -}}
<canvas class="figure__chart" id="{{ . }}">
You must enable Javascript to view this chart.
</canvas>
{{- end -}}
{{- with .Get "chart-id-2" -}}
<canvas class="figure__chart" id="{{ . }}">
You must enable Javascript to view this chart.
</canvas>
{{- end -}}
{{- if or ( .Get "caption" ) ( .Get "title" ) -}}
<figcaption class="figure__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 -}}
</figure>

View File

@ -1,13 +1,16 @@
<li class="comment">
<article class="comment__body">
<article class="comment__body" itemprop="comment" itemscope itemtype="https://schema.org/Comment">
<header class="comment__header">
<h3 class="comment__author">{{ .Params.author }}</h3>
<h3 class="comment__author" itemprop="author">{{ .Params.author }}</h3>
{{- $publishDate := time .Params.publishDate -}}
<p class="comment__publish-date">
<time class="dt-published" datetime="{{ $publishDate.Format "2006-01-02T15:04:05-07:00" }}" itemprop="datePublished">{{ $publishDate.Format "January 2" }}<sup>{{ if in (slice 1 21 31) $publishDate.Day }}st{{ else if in (slice 2 22) $publishDate.Day}}nd{{ else if in (slice 3 23) $publishDate.Day }}rd{{ else }}th{{ end }}</sup>, 1{{ $publishDate.Format "2006" | lang.NumFmt 0 }}&nbsp;<abbr style="font-variant: small-caps; font-size: 0.8em;" title="Holocene Era">HE</abbr></time>
</p>
{{- with .Params.source -}}
<p class="comment__source">Source: {{ . }}</p>
{{- end -}}
</header>
{{ .Inner | markdownify }}
<footer class="comment__footer">
{{ with .Params.source }}<p class="comment__source">Source: {{ . }}</p>{{ end }}
</footer>
{{- .Inner | markdownify -}}
</article>
</li>

View File

@ -1,94 +1,75 @@
{{- if ( and ( .Get "src" ) ( .Get "chart-id" ) ) -}}
{{- errorf "Both chart ID and resource source defined" -}}
{{- end -}}
{{ $src := $.Page.Resources.GetMatch (.Get "src") }}
{{ if ( and ( not $src ) ( not ( .Get "chart-id" ) ) ) }}
{{- $src := $.Page.Resources.GetMatch (.Get "src") -}}
{{- if ( not $src ) -}}
{{- errorf "No Page Resource found for src '%q' (%q)" ( .Get "src" ) .Page.File.Path -}}
{{ end }}
{{ $linkedResource := $.Page.Resources.GetMatch (.Get "link") }}
{{- end -}}
{{- $linkedResource := $.Page.Resources.GetMatch (.Get "link") -}}
<figure class="article__figure figure{{ with .Get "class" }} {{ . }}{{ end }}">
{{- with .Get "chart-id" -}}
<canvas class="figure__chart" id="{{ . }}">
You must enable Javascript to view this chart.
</canvas>
{{- else -}}
{{- if .Get "link" -}}
{{- if $linkedResource }}
<a href="{{ $linkedResource.RelPermalink }}"{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{ else }}
<a href="{{ .Get "link" }}">
{{ end }}
{{- end -}}
{{- if eq $src.ResourceType "image" -}}
<picture class="figure__picture"
itemprop="image">
<img class="u-photo figure__image"
{{ if ( or ( eq $src.MediaType.SubType "svg" ) ( eq $src.MediaType.SubType "gif" ) ) }}
src="{{ $src.RelPermalink }}"
{{ else }}
{{ with $src.Resize "1200x webp" }}
src="{{ .RelPermalink }}"
{{ end }}
width="{{ $src.Width }}"
height="{{ $src.Height }}"
{{ end }}
{{- with $src.Params.alt }}
alt="{{ . }}"
{{- end -}}
{{- with $src.Params.title }} title="{{ . }}" {{ end -}}
loading="lazy"
role="img"
/>
</picture>
{{- else if eq $src.ResourceType "video" -}}
{{- if eq $src.MediaType "video/ogg" -}}
<audio class="u-audio figure__audio" itemprop="audio" controls>
<source src="{{ $src.RelPermalink }}" type="{{ $src.MediaType }}" />
<p>Your browser doesn't support embedded audio, <a href="{{ $src.RelPermalink }}">view the audio here</a>.</p>
</audio>
{{- else -}}
<video class="u-video figure__video"
controls
src="{{ $src.RelPermalink }}"
poster="
{{- if $src.Params.poster -}}
{{- $posterSrc := $.Page.Resources.GetMatch ( .Get $src.Params.poster ) -}}
{{- with $posterSrc.Resize "1200x webp" -}}
{{- .RelPermalink -}}
{{- end -}}
{{- else -}}
{{- warnf "No poster defined for resource %q (%q)" $src.RelPermalink .Page.File.Path -}}
{{- end -}}
"
itemprop="video"
>
Your browser doesn't support embedded video, <a href="{{ $src.RelPermalink }}">view the video here</a>.
</video>
{{- end -}}
{{- else if ( or ( ne $src.ResourceType "image" ) ( ne $src.ResourceType "video" ) ) -}}
{{- errorf "No handling for resource of type %q" $src.ResourceType -}}
{{- end -}}
{{- if .Get "link" }}</a>{{ end -}}
<figure class="article__figure figure{{ with .Get "class" }} {{ . }}{{ end }}" role="group">
{{- if .Get "link" -}}
{{- if $linkedResource }}
<a href="{{ $linkedResource.RelPermalink }}"{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{ else }}
<a href="{{ .Get "link" }}">
{{ end }}
{{- end -}}
{{- if eq $src.ResourceType "image" -}}
<picture class="figure__picture"
itemprop="image">
<img class="u-photo figure__image"
{{ if ( or ( eq $src.MediaType.SubType "svg" ) ( eq $src.MediaType.SubType "gif" ) ) }}
src="{{ $src.RelPermalink }}"
{{ else }}
{{ with $src.Resize "1200x webp" }}
src="{{ .RelPermalink }}"
{{ end }}
width="{{ $src.Width }}"
height="{{ $src.Height }}"
{{ end }}
{{- with $src.Params.alt }}
alt="{{ . }}"
{{- end -}}
{{- with $src.Params.title }} title="{{ . }}" {{ end -}}
loading="lazy"
role="img"
/>
</picture>
{{- else if eq $src.ResourceType "video" -}}
{{- if eq $src.MediaType "video/ogg" -}}
<audio class="u-audio figure__audio" itemprop="audio" controls>
<source src="{{ $src.RelPermalink }}" type="{{ $src.MediaType }}" />
<p>Your browser doesn't support embedded audio, <a href="{{ $src.RelPermalink }}">view the audio here</a>.</p>
</audio>
{{- else -}}
<video class="u-video figure__video"
controls
src="{{ $src.RelPermalink }}"
poster="
{{- if $src.Params.poster -}}
{{- $posterSrc := $.Page.Resources.GetMatch ( .Get $src.Params.poster ) -}}
{{- with $posterSrc.Resize "1200x webp" -}}
{{- .RelPermalink -}}
{{- end -}}
{{- else -}}
{{- warnf "No poster defined for resource %q (%q)" $src.RelPermalink .Page.File.Path -}}
{{- end -}}
"
itemprop="video">
Your browser doesn't support embedded video, <a href="{{ $src.RelPermalink }}">view the video here</a>.
</video>
{{- end -}}
{{- else if ( or ( ne $src.ResourceType "image" ) ( ne $src.ResourceType "video" ) ) -}}
{{- errorf "No handling for resource of type %q" $src.ResourceType -}}
{{- end -}}
{{- if .Get "link" }}</a>{{ end -}}
{{- if or ( .Get "caption" ) ( .Get "title" ) ( $src.Params.attr ) -}}
<figcaption class="figure__caption{{ if not ( or ( .Get "caption" ) ( .Get "title" ) ) }} figure__caption--no-height{{ end }}">
{{- with $src -}}
{{ if .Params.attrlink -}}
<a class="figcaption__attrlink" href="{{ .Params.attrlink }}">
{{- 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 -}}
{{- end -}}
{{- if .Params.attrlink -}}<a class="figcaption__attrlink" href="{{ .Params.attrlink }}">{{- 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 -}}
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}}
{{- with .Get "caption" -}}
<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>
{{- end -}}
{{- with .Get "caption" -}}<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>{{- end -}}
</figcaption>
{{- end -}}
</figure>

View File

@ -1,30 +1,81 @@
<!-- count how many times we've called this shortcode; load the css if it's the first time -->
{{- if not ($.Page.Scratch.Get "figurecount") }}<link rel="stylesheet" href={{ "css/hugo-easy-gallery.css" | relURL }} />{{ end }}
{{- $.Page.Scratch.Add "figurecount" 1 }}
{{ $baseURL := .Site.BaseURL }}
<div class="gallery caption-position-{{ with .Get "caption-position" | default "bottom" }}{{.}}{{end}} caption-effect-{{ with .Get "caption-effect" | default "slide" }}{{.}}{{end}} hover-effect-{{ with .Get "hover-effect" | default "zoom" }}{{.}}{{end}} {{ if ne (.Get "hover-transition") "none" }}hover-transition{{end}}" itemscope itemtype="http://schema.org/ImageGallery">
<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 -->
{{- $files := readDir ( print "content/" $.Page.File.Dir . ) }}
{{- range $files -}}
<!-- skip files that aren't images, or that include the thumb suffix in their name -->
{{- $isimg := lower .Name | findRE "\\.(gif|jpg|jpeg|tiff|png|bmp|webp|avif|jxl)" }}<!-- is the current file an image? -->
{{- if $isimg }}
{{- $caption := .Name | replaceRE "\\..*" "" | humanize }}<!-- humanized filename without extension -->
{{- $linkURL := print $.Page.Permalink ($.Get "dir") "/" .Name | absURL }}<!-- absolute URL to hi-res image -->
<div class="box">
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<div class="img" style="background-image: url('{{ $linkURL }}');" >
<img itemprop="thumbnail" loading="lazy" src="{{ $linkURL }}" alt="{{ $caption }}" /><!-- <img> hidden if in .gallery -->
</div>
<a href="{{ $linkURL }}" itemprop="contentUrl"></a><!-- put <a> last so it is stacked on top -->
</figure>
</div>
{{- end }}
{{- $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 }}
</div>
</figure>

View File

@ -1,4 +1,8 @@
{{- $resource := .Page.Resources.GetMatch ($.Get 0) -}}
{{- with $resource -}}
{{- $resource.RelPermalink -}}
{{- $src := $.Page.Resources.GetMatch ($.Get 0) -}}
{{- if ( not $src ) -}}
{{- errorf "No Page Resource found for src '%q' (%q)" ( $.Get 0 ) .Page.File.Path -}}
{{- end -}}
{{- with $src -}}
{{- .RelPermalink -}}
{{- end -}}