Add photoswipe

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-08-08 17:55:55 +02:00
parent 8e240134b0
commit 61650e9c0f
17 changed files with 9938 additions and 53 deletions

View File

@@ -0,0 +1,2 @@
<meta name="robots" content="all,follow" />
<meta name="googlebot" content="index,follow,snippet,archive" />

View File

@@ -0,0 +1,17 @@
{{ with resources.Get "css/photoswipe/photoswipe.css" | minify | fingerprint }}
<link
rel="stylesheet"
href="{{- .RelPermalink -}}"
integrity="{{- .Data.Integrity -}}"
/>
{{ end }}
{{ $opts := dict "minify" true }}
{{ with resources.Get "js/photoswipe.js" | js.Build $opts | minify | fingerprint }}
<script
src="{{ .RelPermalink }}"
integrity="{{ .Data.Integrity }}"
crossorigin="anonymous"
async
></script>
{{ end }}

View File

@@ -0,0 +1,5 @@
{{ with .OutputFormats.Get "RSS" }}
{{ printf `
<link href="%s" rel="%s" type="%s" title="%s" />` .Permalink .Rel .MediaType.Type $.Site.Title | safeHTML
}}
{{ end }}

View File

@@ -0,0 +1,8 @@
{{ $opts := dict "targetPath" "css/main.css" }}
{{ with resources.Get "sass/main.scss" | css.Sass $opts | minify | fingerprint }}
<link
rel="stylesheet"
href="{{- .RelPermalink -}}"
integrity="{{- .Data.Integrity -}}"
/>
{{ end }}

View File

@@ -1,13 +1,3 @@
{{ with .Params.image }}
{{ $image := $.Resources.GetMatch . }}
{{ with $image }}
{{ $thumb := .Resize "400x" }}
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="{{- $thumb.Permalink -}}" />
{{ end }}
{{ end }}
<meta name="twitter:title" content="{{- .Title -}}" />
<meta
name="twitter:description"
@@ -21,3 +11,12 @@
{{- end -}}
{{- end -}}"
/>
{{ with .Params.image }}
{{ $image := $.Resources.GetMatch . }}
{{ with $image }}
{{ $thumb := .Resize "400x" }}
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content="{{- $thumb.Permalink -}}" />
{{ end }}
{{ end }}

View File

@@ -2,15 +2,28 @@
{{- $caption := .caption -}}
{{- $alt := default .caption .alt -}}
{{ if $path }}
<figure class="image">
<img
src="{{- $path | absURL -}}"
{{ with $caption }}title="{{- . -}}"{{ end }}
{{ with $alt }}alt="{{- . -}}"{{ end }}
/>
{{ with $caption }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>
{{ end }}
{{- if $path -}}
{{- $isRemote := strings.HasPrefix $path "http" -}}
{{- $image := cond $isRemote (resources.GetRemote $path) (resources.Get $path) -}}
{{- if $image -}}
<figure class="image gallery">
<a
href="{{- $image.RelPermalink -}}"
data-pswp-width="{{- $image.Width -}}"
data-pswp-height="{{- $image.Height -}}"
>
<img
src="{{- $image.RelPermalink -}}"
width="{{- $image.Width -}}"
height="{{- $image.Height -}}"
{{ with $caption }}title="{{- . -}}"{{ end }}
{{ with $alt }}alt="{{- . -}}"{{ end }}
/>
</a>
{{ with $caption }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>
{{- end -}}
{{- end -}}