diff options
author | tdro <tdro@noreply.example.com> | 2022-12-26 17:01:51 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2022-12-27 20:46:15 -0500 |
commit | d27b1096ac6f3f9d5880ecbd97097bfceecefa13 (patch) | |
tree | 70a35f7b44121fa0b4cbc9b8a45b62cb8b368fe4 /themes/default/layouts/partials/author-section-picture.html | |
parent | 6bed014c0f3b70bbf8739ea2a48520dd154fa091 (diff) | |
download | canory-d27b1096ac6f3f9d5880ecbd97097bfceecefa13.tar.gz canory-d27b1096ac6f3f9d5880ecbd97097bfceecefa13.tar.bz2 canory-d27b1096ac6f3f9d5880ecbd97097bfceecefa13.zip |
themes/default/layouts/partials: Mix down image metadata and expose author.json
Relegate to section and reduce the rate of multiplicative image transformations
Diffstat (limited to 'themes/default/layouts/partials/author-section-picture.html')
-rw-r--r-- | themes/default/layouts/partials/author-section-picture.html | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/themes/default/layouts/partials/author-section-picture.html b/themes/default/layouts/partials/author-section-picture.html new file mode 100644 index 0000000..5b718d4 --- /dev/null +++ b/themes/default/layouts/partials/author-section-picture.html @@ -0,0 +1,37 @@ +{{- $author := partial "function-authors-data.html" . -}} +{{- $profile := $author.picture.profile -}} +{{- $file := not (urls.Parse $profile).Host -}} + +{{- if $file -}} + {{- $profile = print $author.user "/" $profile -}} +{{- end -}} + +{{- $image := partial "function-caches-images.html" + (dict + "Source" $profile + "Fit" "160x160" + "Target" (print (partial "function-paths.html" "media") "/" $author.user "/") + "Copy" (print (partial "function-paths.html" "media") "/" $author.user "/" $author.user "-profile" (path.Ext $profile)) + "AlternateCopy" (print (partial "function-paths.html" "media") "/" $author.user "/" $author.user "-profile.webp") + ) +-}} + +{{- $width := $image.Width -}} +{{- $height := $image.Height -}} +{{- $source := $image.RelPermalink -}} +{{- $alternate := $author.name -}} +{{- $sourceset := $image.AltRelPermalink -}} + +{{- $metadata := (dict + "picture" (dict + "profileWidth" $width + "profileHeight" $height + "profileSource" $source + "profileAlternate" $alternate + "profileSourceSet" $sourceset + ) + ) +-}} + +{{- $authorMetadata := merge $author $metadata | jsonify | resources.FromString (print .Section "/author.json") -}} +{{- $writeToFile := $authorMetadata.Permalink -}} |