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

View file

@ -9,7 +9,7 @@
<h2 class="page-title">{{ .Type | singularize }}: <q>{{ .Title | safeHTML }}</q> <h2 class="page-title">{{ .Type | singularize }}: <q>{{ .Title | safeHTML }}</q>
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed"> <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> </a>
{{ end }} {{ end }}
</h2> </h2>

View file

@ -13,7 +13,7 @@
<h2 class="page-title">{{ .Title | safeHTML }} <h2 class="page-title">{{ .Title | safeHTML }}
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed"> <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> </a>
{{ end }} {{ end }}
</h2> </h2>

View file

@ -68,14 +68,14 @@
{{ with .GetPage "blog/posts" }} {{ with .GetPage "blog/posts" }}
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed"> <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> </a>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ else }} {{ else }}
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats -}}
<a href="{{ .RelPermalink }}" aria-label="{{ $.Title }} RSS feed"> <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> </a>
{{ end }} {{ end }}
{{ end }} {{ end }}

View file

@ -48,14 +48,14 @@
<script id="MathJax-script" async src="/js/mathjax/tex-chtml.js"></script> <script id="MathJax-script" async src="/js/mathjax/tex-chtml.js"></script>
<script src="/js/mathjax/config.js"></script> <script src="/js/mathjax/config.js"></script>
{{ end }} {{ end }}
{{ if in . "charts" }} {{ end }}
{{ if $.HasShortcode "chart" }}
{{ $chartsCoreJS := resources.Get "js/chart.js" | fingerprint }} {{ $chartsCoreJS := resources.Get "js/chart.js" | fingerprint }}
{{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" }} {{ $chartsConfigJS := $.Page.Resources.GetMatch "charts-init" }}
<script id="Charts-script" src="{{ $chartsCoreJS.Permalink }}" integrity="{{ $chartsCoreJS.Data.Integrity }}"></script> <script id="Charts-script" src="{{ $chartsCoreJS.Permalink }}" integrity="{{ $chartsCoreJS.Data.Integrity }}"></script>
<script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}"></script> <script id="Charts-config-script" src="{{ $chartsConfigJS.Permalink }}"></script>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ end }}
{{ define "main-header" }} {{ define "main-header" }}
<header class="site-content__header"> <header class="site-content__header">
@ -241,14 +241,23 @@
</section> </section>
{{ end }} {{ end }}
{{ if fileExists ( path.Join $.Page.File.Dir "Corrigendum.md" ) }} {{ if fileExists ( path.Join $.Page.File.Dir "corrigendum.md" ) }}
<section class="article-body__corrigendum"> <section class="article-body__corrigendum" itemprop="correction" itemscope itemtype="https://schema.org/CorrectionComment">
<h2 class="subheading subheading--corrigendum" id="corrigendum">Corrigendum</h2> <h2 class="subheading subheading--corrigendum" id="corrigendum">Corrigendum</h2>
{{ $file := path.Join $.Page.File.Dir "corrigendum.md" | readFile }} {{ $file := path.Join $.Page.File.Dir "corrigendum.md" | readFile }}
{{ $file | .RenderString }} {{ $file | .RenderString }}
</section> </section>
{{ end }} {{ end }}
</section> </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 }} {{ end }}
{{ define "main-footer" }} {{ define "main-footer" }}

View file

@ -1,6 +1,6 @@
{{- $itemType := default "CreativeWork" ( .Params.schemaType ) -}} {{- $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 -}} {{- with .Params.href -}}
<a href="{{ if eq . "asCite" }}{{ $.Params.cite }}{{ else }}{{ . }}{{ end }}"> <a href="{{ if eq . "asCite" }}{{ $.Params.cite }}{{ else }}{{ . }}{{ end }}">
{{- end -}} {{- end -}}
@ -34,5 +34,5 @@
</a> </a>
{{- end -}} {{- end -}}
{{- else -}} {{- 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 -}} {{- end -}}

View file

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

View file

@ -2,7 +2,7 @@
{{ block "header" . }} {{ 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> <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="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" . }} {{ partial "header/site-nav.html" . }}
{{ end }} {{ end }}
</header> </header>

View file

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

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"> <footer class="site-content__footer">
<h2>Meta</h2> <h2>Meta</h2>

View file

@ -6,11 +6,10 @@
class="figure--blockquote blockquote{{- if .Params.style }} blockquote--{{- .Params.style -}}{{- end -}}" class="figure--blockquote blockquote{{- if .Params.style }} blockquote--{{- .Params.style -}}{{- end -}}"
itemscope itemscope
itemtype="Quotation" itemtype="Quotation"
> role="group">
<blockquote <blockquote
class="blockquote__body" class="blockquote__body"
{{- if .Params.cite }} cite="{{ .Params.cite }}"{{- end -}} {{- if .Params.cite }} cite="{{ .Params.cite }}"{{- end -}}>
>
{{- .Inner | .Page.RenderString -}} {{- .Inner | .Page.RenderString -}}
</blockquote> </blockquote>
<figcaption class="blockquote__caption"> <figcaption class="blockquote__caption">
@ -25,6 +24,7 @@
{{- .Scratch.SetInMap "Params" "titleTr" .Params.titleSeriesTr -}} {{- .Scratch.SetInMap "Params" "titleTr" .Params.titleSeriesTr -}}
{{- .Scratch.SetInMap "Params" "cite" .Params.citeSeries -}} {{- .Scratch.SetInMap "Params" "cite" .Params.citeSeries -}}
{{- .Scratch.SetInMap "Params" "schemaType" .Params.schemaTypeSeries -}} {{- .Scratch.SetInMap "Params" "schemaType" .Params.schemaTypeSeries -}}
{{- .Scratch.SetInMap "Params" "suppress" "true" -}}
{{- .Scratch.SetInMap "parentCite" "Params" ( .Scratch.Get "Params" ) -}} {{- .Scratch.SetInMap "parentCite" "Params" ( .Scratch.Get "Params" ) -}}
{{- partial "cite.html" ( .Scratch.Get "parentCite" ) -}} {{- partial "cite.html" ( .Scratch.Get "parentCite" ) -}}
{{- with .Params.numberSeries }}, {{ . | safeHTML -}}{{- end -}} {{- 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"> <li class="comment">
<article class="comment__body"> <article class="comment__body" itemprop="comment" itemscope itemtype="https://schema.org/Comment">
<header class="comment__header"> <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> </header>
{{ .Inner | markdownify }} {{- .Inner | markdownify -}}
<footer class="comment__footer">
{{ with .Params.source }}<p class="comment__source">Source: {{ . }}</p>{{ end }}
</footer>
</article> </article>
</li> </li>

View file

@ -1,19 +1,10 @@
{{- if ( and ( .Get "src" ) ( .Get "chart-id" ) ) -}} {{- $src := $.Page.Resources.GetMatch (.Get "src") -}}
{{- errorf "Both chart ID and resource source defined" -}} {{- if ( not $src ) -}}
{{- end -}}
{{ $src := $.Page.Resources.GetMatch (.Get "src") }}
{{ if ( and ( not $src ) ( not ( .Get "chart-id" ) ) ) }}
{{- errorf "No Page Resource found for src '%q' (%q)" ( .Get "src" ) .Page.File.Path -}} {{- errorf "No Page Resource found for src '%q' (%q)" ( .Get "src" ) .Page.File.Path -}}
{{ end }} {{- end -}}
{{ $linkedResource := $.Page.Resources.GetMatch (.Get "link") }} {{- $linkedResource := $.Page.Resources.GetMatch (.Get "link") -}}
<figure class="article__figure figure{{ with .Get "class" }} {{ . }}{{ end }}"> <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>
{{- else -}}
{{- if .Get "link" -}} {{- if .Get "link" -}}
{{- if $linkedResource }} {{- if $linkedResource }}
<a href="{{ $linkedResource.RelPermalink }}"{{ with .Get "rel" }} rel="{{ . }}"{{ end }}> <a href="{{ $linkedResource.RelPermalink }}"{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
@ -63,8 +54,7 @@
{{- warnf "No poster defined for resource %q (%q)" $src.RelPermalink .Page.File.Path -}} {{- warnf "No poster defined for resource %q (%q)" $src.RelPermalink .Page.File.Path -}}
{{- end -}} {{- end -}}
" "
itemprop="video" itemprop="video">
>
Your browser doesn't support embedded video, <a href="{{ $src.RelPermalink }}">view the video here</a>. Your browser doesn't support embedded video, <a href="{{ $src.RelPermalink }}">view the video here</a>.
</video> </video>
{{- end -}} {{- end -}}
@ -72,23 +62,14 @@
{{- errorf "No handling for resource of type %q" $src.ResourceType -}} {{- errorf "No handling for resource of type %q" $src.ResourceType -}}
{{- end -}} {{- end -}}
{{- if .Get "link" }}</a>{{ end -}} {{- if .Get "link" }}</a>{{ end -}}
{{- end -}}
{{- if or ( .Get "caption" ) ( .Get "title" ) ( $src.Params.attr ) -}} {{- 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 }}"> <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.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.attr -}}<p class="figcaption__attr">{{ .Params.attr | safeHTML }}{{ with .Params.attrlicence }} <span class="figcaption__licence">{{ . | safeHTML }}</span>{{ end }}</p>{{- end -}}
{{- if .Params.attrlink -}} {{- if .Params.attrlink -}}</a>{{- end -}}
</a>
{{- end -}}
{{- end -}}
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}} {{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}}
{{- with .Get "caption" -}} {{- with .Get "caption" -}}<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>{{- end -}}
<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>
{{- end -}}
</figcaption> </figcaption>
{{- end -}} {{- end -}}
</figure> </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 --> <figure class="figure--gallery gallery" itemscope itemtype="http://schema.org/ImageGallery">
{{- if not ($.Page.Scratch.Get "figurecount") }}<link rel="stylesheet" href={{ "css/hugo-easy-gallery.css" | relURL }} />{{ end }} {{- if or ( .Get "caption" ) ( .Get "title" ) -}}
{{- $.Page.Scratch.Add "figurecount" 1 }} <figcaption class="figure__caption gallery__caption{{ if not ( or ( .Get "caption" ) ( .Get "title" ) ) }} figure__caption--no-height{{ end }}">
{{ $baseURL := .Site.BaseURL }} {{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}}
<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"> {{- with .Get "caption" -}}
<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>
{{- end -}}
</figcaption>
{{- end -}}
{{- with (.Get "dir") -}} {{- with (.Get "dir") -}}
<!-- If a directory was specified, generate figures for all of the images in the directory --> <!-- If a directory was specified, generate figures for all of the images in the directory -->
{{- $files := readDir ( print "content/" $.Page.File.Dir . ) }} {{- $images := $.Page.Resources.Match ( print . "/*" ) }}
{{- range $files -}} {{- range $images -}}
<!-- 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 --> {{- $caption := .Name | replaceRE "\\..*" "" | humanize }}<!-- humanized filename without extension -->
{{- $linkURL := print $.Page.Permalink ($.Get "dir") "/" .Name | absURL }}<!-- absolute URL to hi-res image --> {{- $linkURL := print $.Page.Permalink ($.Get "dir") "/" .Name | absURL }}<!-- absolute URL to hi-res image -->
<div class="box"> <figure class="figure gallery__figure" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"> <a href="{{ .RelPermalink }}" itemprop="contentUrl">
<div class="img" style="background-image: url('{{ $linkURL }}');" > <picture class="figure__picture"
<img itemprop="thumbnail" loading="lazy" src="{{ $linkURL }}" alt="{{ $caption }}" /><!-- <img> hidden if in .gallery --> itemprop="image">
</div> <img itemprop="thumbnail"
<a href="{{ $linkURL }}" itemprop="contentUrl"></a><!-- put <a> last so it is stacked on top --> 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> </figure>
</div>
{{- end }}
{{- end }} {{- end }}
{{- else -}} {{- else -}}
<!-- If no directory was specified, include any figure shortcodes called within the gallery --> <!-- If no directory was specified, include any figure shortcodes called within the gallery -->
{{ .Inner }} {{ .Inner }}
{{- end }} {{- end }}
</div> </figure>

View file

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