diff --git a/config.toml b/config.toml index 13506671..e3c7bd62 100644 --- a/config.toml +++ b/config.toml @@ -2,4 +2,4 @@ [module.hugoVersion] extended = true min = "0.87.0" -max = "0.147.0" \ No newline at end of file +max = "0.147.1" \ No newline at end of file diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 27ca17d6..46f47769 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -72,7 +72,7 @@ {{ $bundleJS := $assets.Get "js" | resources.Concat "js/main.bundle.js" | resources.Minify | resources.Fingerprint "sha512" }} {{ end }} {{ if not .Site.Params.disableImageZoom | default true }} diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html index c01b48f8..31d9bc9b 100644 --- a/layouts/shortcodes/gallery.html +++ b/layouts/shortcodes/gallery.html @@ -1,5 +1,31 @@ {{ $id := delimit (slice "gallery" (partial "functions/uid.html" .)) "-" }} \ No newline at end of file + {{ $page := .Page }} + + {{/* find all img tags */}} + {{ $imgTagRegex := `]*>` }} + {{ $imgTags := findRE $imgTagRegex .Inner }} + {{ $newContent := .Inner }} + + {{ range $imgTags }} + {{ $imgTag := . }} + {{/* extract src attribute */}} + {{ $srcRegex := `src=['"]([^'"]+)['"]` }} + {{ $srcMatches := findRESubmatch $srcRegex $imgTag }} + + {{ if $srcMatches }} + {{ $srcFull := index (index $srcMatches 0) 0 }} + {{ $src := index (index $srcMatches 0) 1 }} + + {{ $resource := $page.Resources.GetMatch $src }} + {{ if $resource }} + {{ $newSrc := printf `src="%s"` $resource.RelPermalink }} + {{ $newImg := replace $imgTag $srcFull $newSrc }} + {{ $newContent = replace $newContent $imgTag $newImg }} + {{ end }} + {{ end }} + {{ end }} + + {{ $newContent | safeHTML }} + diff --git a/layouts/shortcodes/github.html b/layouts/shortcodes/github.html index 56146975..484d7e90 100644 --- a/layouts/shortcodes/github.html +++ b/layouts/shortcodes/github.html @@ -4,6 +4,7 @@ {{- $githubColors := .Site.Data.githubColors -}} {{- with $githubData -}} +
{{- end -}} diff --git a/package.json b/package.json index d8597d9f..35c422c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hugo-blowfish-theme", - "version": "2.85.0", + "version": "2.85.1", "description": "Blowfish theme for Hugo.", "scripts": { "postinstall": "vendor-copy", diff --git a/release-versions/hugo-latest.txt b/release-versions/hugo-latest.txt index 670964c6..e79ab786 100644 --- a/release-versions/hugo-latest.txt +++ b/release-versions/hugo-latest.txt @@ -1 +1 @@ -v0.147.0 +v0.147.1