diff options
-rw-r--r-- | assets/data/media/404.png (renamed from static/images/404.png) | bin | 6718 -> 6718 bytes | |||
-rw-r--r-- | assets/data/media/logo.png (renamed from assets/images/logo.png) | bin | 170667 -> 170667 bytes | |||
-rw-r--r-- | config.json | 2 | ||||
-rw-r--r-- | config.toml | 2 | ||||
-rw-r--r-- | config.yaml | 2 | ||||
-rw-r--r-- | themes/default/layouts/_default/_markup/render-image.html | 43 | ||||
-rw-r--r-- | themes/default/layouts/partials/author-card.html | 9 | ||||
-rw-r--r-- | themes/default/layouts/partials/author-header.html | 10 | ||||
-rw-r--r-- | themes/default/layouts/partials/author-picture.html | 10 | ||||
-rw-r--r-- | themes/default/layouts/partials/function-paths-media.html | 1 | ||||
-rw-r--r-- | themes/default/layouts/partials/gallery-walk.html | 2 | ||||
-rw-r--r-- | themes/default/layouts/partials/generate-feeds.html | 12 |
12 files changed, 47 insertions, 46 deletions
diff --git a/static/images/404.png b/assets/data/media/404.png Binary files differindex b9b4d26..b9b4d26 100644 --- a/static/images/404.png +++ b/assets/data/media/404.png diff --git a/assets/images/logo.png b/assets/data/media/logo.png Binary files differindex 51baf7d..51baf7d 100644 --- a/assets/images/logo.png +++ b/assets/data/media/logo.png diff --git a/config.json b/config.json index 2d23181..845d573 100644 --- a/config.json +++ b/config.json @@ -102,7 +102,7 @@ "themeColor": "#ffffff", "backgroundColor": "#ffffff", "display": "standalone", - "logo": "images/logo.png" + "logo": "data/media/logo.png" }, "csp": { "upgrade": false, diff --git a/config.toml b/config.toml index 7f78cf4..bf7f352 100644 --- a/config.toml +++ b/config.toml @@ -95,7 +95,7 @@ enableRobotsTXT = true themeColor = "#ffffff" backgroundColor = "#ffffff" display = "standalone" - logo = "images/logo.png" + logo = "data/media/logo.png" [params.csp] upgrade = false diff --git a/config.yaml b/config.yaml index 0e3f7ca..fd17f55 100644 --- a/config.yaml +++ b/config.yaml @@ -84,7 +84,7 @@ params: themeColor: '#ffffff' backgroundColor: '#ffffff' display: standalone - logo: images/logo.png + logo: data/media/logo.png csp: upgrade: false referrer: no-referrer diff --git a/themes/default/layouts/_default/_markup/render-image.html b/themes/default/layouts/_default/_markup/render-image.html index 3c027a9..8f03de5 100644 --- a/themes/default/layouts/_default/_markup/render-image.html +++ b/themes/default/layouts/_default/_markup/render-image.html @@ -1,31 +1,31 @@ -{{- $source := $.Destination | safeURL -}} -{{- $public := print "public/" $source -}} -{{- $remote := resources.GetRemote $source -}} -{{- $local := "" -}} -{{- $width := "" -}} -{{- $height := "" -}} -{{- $cache := "" -}} -{{- $dimensions := "600x360" -}} +{{- $source := $.Destination | safeURL -}} +{{- $public := print "public/" $source -}} +{{- $remote := resources.GetRemote $source -}} +{{- $local := "" -}} +{{- $width := "" -}} +{{- $height := "" -}} +{{- $cache := "" -}} +{{- $dimensions := "600x360" -}} +{{- $immutable := print (.Page.Permalink | humanize | urlize) "-" ($source | sha256 | truncate 8 "") -}} {{- with $remote -}} {{- with .Err -}} {{- if fileExists $public -}} {{- $local = resources.Get $public -}} {{- with $local -}} - {{- $local = .Content | resources.FromString (print "/data/static/images/" (. | urlize)) }} + {{- $local = .Content | resources.FromString (print (partial "function-paths-media.html") "/" $.Page.Section "/" (path.Base .)) -}} {{- end -}} {{ $source = print ("" | absURL) $source }} {{- else -}} - {{- $404origin := print "/images/404.png" -}} - {{- $404image := imageConfig (print "static/" $404origin) -}} + {{- $404image := resources.Get "data/media/404.png" -}} {{- with $404image -}} {{- $width = .Width -}} {{- $height = .Height -}} {{- end -}} - {{ $source = print ("" | absURL) $404origin }} + {{ $source = $404image.RelPermalink }} {{- end -}} {{- else -}} - {{- $cache = .Content | resources.FromString (print $.Page.Section "/media/" (. | urlize)) -}} + {{- $cache = .Content | resources.FromString (print (partial "function-paths-media.html") "/" $.Page.Section "/" (path.Base .)) -}} {{ end }} {{ end }} {{- /* This comment removes trailing newlines and white spaces. */ -}} @@ -33,16 +33,21 @@ <a href="{{ $source }}"> <picture> {{- with $local }} - <source srcset="{{- ($local.Fit (print $dimensions " webp")).RelPermalink -}}" type="image/webp" /> - {{- $local = $local.Fit $dimensions }} + {{- $local = .Fit (print $dimensions " webp") }} + {{- $local = $local | resources.Copy (print (partial "function-paths-media.html") "/" $.Page.Section "/" $immutable ".webp") }} + <source srcset="{{- $local.RelPermalink -}}" type="image/webp" /> + {{- $local = .Fit $dimensions }} + {{- $local = $local | resources.Copy (print (partial "function-paths-media.html") "/" $.Page.Section "/" $immutable (path.Ext $local)) }} {{- $width = $local.Width -}} {{- $height = $local.Height -}} + {{- $writeToFile := $local.Permalink }} {{- end }} {{- with $cache }} - {{- $cache = .Content | resources.FromString (print "/data/static/images/" (. | urlize)) }} - <source srcset="{{- ($cache.Fit (print $dimensions " webp")).RelPermalink -}}" type="image/webp" /> - {{- $cache = .Content | resources.FromString (. | urlize) -}} - {{- $cache = $cache.Fit $dimensions }} + {{- $cache = .Fit (print $dimensions " webp") }} + {{- $cache = $cache | resources.Copy (print $.Page.Section "/media/" $immutable ".webp") }} + <source srcset="{{- $cache.RelPermalink -}}" type="image/webp" /> + {{- $cache = .Fit $dimensions }} + {{- $cache = $cache | resources.Copy (print (partial "function-paths-media.html") "/" $.Page.Section "/" $immutable (path.Ext $cache)) }} {{- $width = $cache.Width -}} {{- $height = $cache.Height -}} {{- $cache = $cache.RelPermalink }} diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html index 26a8e31..3e4bcca 100644 --- a/themes/default/layouts/partials/author-card.html +++ b/themes/default/layouts/partials/author-card.html @@ -1,6 +1,7 @@ {{- $path := print "public/" .Data.user "/media/profile/picture.png" -}} {{- $image := resources.Get $path -}} {{- $dimensions := "96x96" -}} +{{- $404image := resources.Get "data/media/404.png" -}} <micro-author> <micro-card> @@ -10,24 +11,22 @@ <a title="{{ .Data.name }}" href="{{ "" | absURL }}/{{ .Data.user }}/#"> <picture> {{- with $image }} - {{- $image = .Content | resources.FromString (print "/data/static/images/" ($image | urlize)) }} + {{- $image = .Content | resources.FromString (print (partial "function-paths-media.html") "/" $.Data.user "/" (path.Base .)) }} <source srcset="{{- ($image.Fit (print $dimensions " webp")).RelPermalink -}}" type="image/webp" /> {{- end }} <img alt="{{ .Data.name }}" {{- if fileExists $path }} {{ with $image }} - {{- $image = (.Content | resources.FromString (print "/data/static/images/" ($image | urlize))).Fit $dimensions -}} + {{- $image = (.Content | resources.FromString (print (partial "function-paths-media.html") "/" $.Data.user "/" (path.Base .))).Fit $dimensions -}} width="{{ $image.Width }}" height="{{ $image.Height }}" src="{{ $image.RelPermalink }}" {{- end }} {{ else }} - {{- $404origin := print "/images/404.png" }} - {{- $404image := imageConfig (print "static/" $404origin) }} width="{{ $404image.Width }}" height="{{ $404image.Height }}" - src="{{ $404origin }}" + src="{{ $404image.RelPermalink }}" {{- end -}} /> </picture> diff --git a/themes/default/layouts/partials/author-header.html b/themes/default/layouts/partials/author-header.html index 0590358..9babf1d 100644 --- a/themes/default/layouts/partials/author-header.html +++ b/themes/default/layouts/partials/author-header.html @@ -1,19 +1,19 @@ {{- $file := "/profile/header.jpg" -}} {{- $path := print "public/" (partial "author-media-path.html" .) $file -}} {{- $image := resources.Get $path -}} -{{- $404origin := print "/images/404.png" -}} -{{- $404image := imageConfig (print "static/" $404origin) -}} +{{- $404image := resources.Get "data/media/404.png" -}} {{- $dimensions := "x600" -}} +{{- $author := partial "author-user.html" . }} {{- with $image -}} - {{- $image = .Content | resources.FromString (print "/data/static/images/" (. | urlize)) -}} + {{- $image = .Content | resources.FromString (print (partial "function-paths-media.html") "/" $author "/" (path.Base .)) -}} <source srcset="{{- ($image.Resize (print $dimensions " webp")).RelPermalink -}}" type="image/webp" /> {{- end -}} <img {{ if fileExists $path }} {{- with $image -}} - {{- $image = (.Content | resources.FromString (print "/data/static/images/" ($image | urlize))).Resize $dimensions -}} + {{- $image = (.Content | resources.FromString (print (partial "function-paths-media.html") "/" $author "/" (path.Base .))).Resize $dimensions -}} width="{{ $image.Width }}" height="{{ $image.Height }}" src="{{ $image.RelPermalink }}" @@ -23,7 +23,7 @@ {{- else -}} width="{{ $404image.Width }}" height="{{ $404image.Height }}" - src="{{ $404origin }}" + src="{{ $404image.RelPermalink }}" {{- end }} alt="{{ partial "author-name.html" . }}" /> diff --git a/themes/default/layouts/partials/author-picture.html b/themes/default/layouts/partials/author-picture.html index 9499185..c269efc 100644 --- a/themes/default/layouts/partials/author-picture.html +++ b/themes/default/layouts/partials/author-picture.html @@ -1,14 +1,14 @@ {{- $file := "/profile/picture.png" -}} {{- $path := print "public/" (partial "author-media-path.html" .) $file -}} {{- $image := resources.Get $path -}} -{{- $404origin := print "/images/404.png" -}} -{{- $404image := imageConfig (print "static/" $404origin) -}} +{{- $404image := resources.Get "data/media/404.png" -}} {{- $dimensions := "160x160" -}} +{{- $author := partial "author-user.html" . }} {{- with .Params.feed -}} {{- else -}} {{- with $image -}} - {{- $image = .Content | resources.FromString (print "/data/static/images/" ($image | urlize)) -}} + {{- $image = .Content | resources.FromString (print (partial "function-paths-media.html") "/" $author "/" (path.Base .)) -}} <source srcset="{{- ($image.Fit (print $dimensions " webp")).RelPermalink -}}" type="image/webp" /> {{- end -}} {{ end }} @@ -23,7 +23,7 @@ {{ else }} {{ if fileExists $path }} {{- with $image -}} - {{- $image = (.Content | resources.FromString (print "/data/static/images/" ($image | urlize))).Fit $dimensions -}} + {{- $image = (.Content | resources.FromString (print (partial "function-paths-media.html") "/" $author "/" (path.Base .))).Fit $dimensions -}} width="{{ $image.Width }}" height="{{ $image.Height }}" src="{{ $image.RelPermalink }}" @@ -33,7 +33,7 @@ {{- else -}} width="{{ $404image.Width }}" height="{{ $404image.Height }}" - src="{{ $404origin }}" + src="{{ $404image.RelPermalink }}" {{- end }} alt="{{ partial "author-name.html" . }}" {{ end -}} diff --git a/themes/default/layouts/partials/function-paths-media.html b/themes/default/layouts/partials/function-paths-media.html new file mode 100644 index 0000000..ce50a92 --- /dev/null +++ b/themes/default/layouts/partials/function-paths-media.html @@ -0,0 +1 @@ +{{ return "data/media" }} diff --git a/themes/default/layouts/partials/gallery-walk.html b/themes/default/layouts/partials/gallery-walk.html index e92bf9f..392e336 100644 --- a/themes/default/layouts/partials/gallery-walk.html +++ b/themes/default/layouts/partials/gallery-walk.html @@ -26,7 +26,7 @@ (eq $extension ".webp") }} {{- with $image := resources.Get $path -}} - {{- $imageContent := (.Content | resources.FromString (print "/data/static/images/" ($image | urlize))).Fit $dimensions }} + {{- $imageContent := (.Content | resources.FromString (print (partial "function-paths-media.html") "/gallery-walker_" (path.Base .))).Fit $dimensions }} <img alt="{{- .Name }}" title="{{- .Name }}" diff --git a/themes/default/layouts/partials/generate-feeds.html b/themes/default/layouts/partials/generate-feeds.html index 72d0ee0..d94e39a 100644 --- a/themes/default/layouts/partials/generate-feeds.html +++ b/themes/default/layouts/partials/generate-feeds.html @@ -169,19 +169,15 @@ ) -}} - {{- $imageSource := "/images/404.png" -}} - {{- $imageTitle := "No image found" -}} + {{- $404image := resources.Get "data/media/404.png" -}} + {{- $imageSource := $404image.RelPermalink -}} + {{- $imageTitle := "No image found" -}} {{- with $image := resources.GetRemote $imageCanonicalURL -}} {{- with .Err -}} {{- warnf "%s" . -}} - {{- $fallbackImage := imageConfig (print "static/images/404.png") -}} - {{- with $fallbackImage -}} - {{- $fallbackWidth := .Width -}} - {{- $fallbackHeight := .Height -}} - {{- end -}} {{- else -}} - {{- $imageContent := $image.Content | resources.FromString (print "/data/static/images/" ($image | urlize)) -}} + {{- $imageContent := $image.Content | resources.FromString (print (partial "function-paths-media.html") "/" ($image | urlize)) -}} {{- $imageSource = $imageContent.RelPermalink -}} {{- $imageTitle = $imageCanonicalURL -}} {{- end -}} |