Add photoswipe

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-08-08 19:44:04 +02:00
parent 8e240134b0
commit 9d160b6890
21 changed files with 9949 additions and 62 deletions

View File

@@ -1,7 +1,7 @@
<footer class="footer">
<div class="footer-container">
<div class="copyright">
<a href="{{- "/" | relURL -}}">{{ .Site.Title }}</a> &copy;
<a href="{{- relURL "" -}}">{{ .Site.Title }}</a> &copy;
{{ now.Year }}
</div>
@@ -10,7 +10,7 @@
{{ $len := len .Site.Params.footer }}
{{ range $i, $el := .Site.Params.footer }}
<li>
<a href="{{- $el.url -}}">{{ $el.name }}</a>
<a href="{{- $el.url | safeURL -}}">{{ $el.name }}</a>
</li>
{{ if lt (add $i 1) $len }}
<span class="middot">&middot;</span>

View File

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

View File

@@ -58,12 +58,11 @@
{{ end }}
{{ end }}
{{ $permalink := .Permalink }}
{{ $siteSeries := .Site.Taxonomies.series }}{{ with .Params.series }}
{{ range $name := . }}
{{ $series := index $siteSeries $name }}
{{ range $page := first 6 $series.Pages }}
{{ if ne $page.Permalink $permalink }}
{{ if ne $page.Permalink .Permalink }}
<meta property="og:see_also" content="{{- $page.Permalink -}}" />
{{ end }}
{{ end }}

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

@@ -1,7 +1,7 @@
<header class="header">
<div class="header-container">
<div class="site-title">
<a href="{{- "/" | relURL -}}">{{ .Site.Title }}</a>
<a href="{{- relURL "" -}}">{{ .Site.Title }}</a>
</div>
<input
@@ -18,7 +18,7 @@
<nav class="nav">
<ul>
{{ range .Site.Params.navigation }}
<li><a href="{{- .url -}}">{{ .name }}</a></li>
<li><a href="{{- .url | safeURL -}}">{{ .name }}</a></li>
{{ end }}
</ul>
</nav>

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 -}}

View File

@@ -1,7 +1,7 @@
<div class="posts-list">
{{ range sort .Pages "Date" "desc" }}
{{ if not .Params.private }}
<a href="{{ .Permalink }}" class="post">
<a href="{{- .RelPermalink -}}" class="post">
<h1 class="title">{{ .Title }}</h1>
<div class="summary">{{ .Summary }}</div>
<div class="meta">