diff options
author | kdevo <kdevo@users.noreply.github.com> | 2020-07-11 23:52:48 +0300 |
---|---|---|
committer | kdevo <kdevo@users.noreply.github.com> | 2020-07-11 23:52:48 +0300 |
commit | a106983eacecfc4556b82c24b1fbfc09e6539f42 (patch) | |
tree | cf84f32e3b948ae4e1d6a558f62b8e207477b010 /layouts | |
parent | 84f4bc15e9009fa53285b5f204a8ba6686176e1c (diff) |
:recycle: :sparkles: Refactor and introduce gallery item image processing
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/index.html | 8 | ||||
-rw-r--r-- | layouts/partials/footer.html | 2 | ||||
-rw-r--r-- | layouts/partials/gallery-img.html | 25 |
3 files changed, 24 insertions, 11 deletions
diff --git a/layouts/index.html b/layouts/index.html index 5c25c12..e1afe8c 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -14,9 +14,11 @@ {{ end }} <!-- Blog --> - <!-- {{ if not (eq (len (where .Site.RegularPages "Section" "blog")) 0) }} - {{ partial "blog.html" . }} - {{ end }} --> + {{ if .Site.Params.Feat.useBlog -}} + {{ if not (eq (len (where .Site.RegularPages "Section" "blog")) 0) }} + {{ partial "blog.html" . }} + {{ end }} + {{ end }} <!-- Contact --> {{ partial "contact.html" . }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 8262a66..6cfec5a 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -13,7 +13,7 @@ {{ end }} {{ if or (.Site.Params.credit) (eq (isset .Site.Params "credit") false) -}} <div class="col-xs-12"> - <small>Theme: <a href="https://github.com/kdevo/osprey-delight" target="_blank">osprey-delight</a> (forked from <a href="https://github.com/tomanistor/osprey" target="_blank">osprey</a>).</small> + <small>Theme: <a href="https://github.com/kdevo/osprey-delight" target="_blank">osprey-delight</a> (fork of <a href="https://github.com/tomanistor/osprey" target="_blank">osprey</a>).</small> </div> {{- end }} </small> diff --git a/layouts/partials/gallery-img.html b/layouts/partials/gallery-img.html index 6e4c944..775c9a8 100644 --- a/layouts/partials/gallery-img.html +++ b/layouts/partials/gallery-img.html @@ -1,16 +1,27 @@ {{ $scratch := newScratch }} -{{ with .Params.absImage -}} - {{ $scratch.Set "img" (. | absURL) }} +{{ with .Params.image -}} + {{ with (resources.Get .) -}} + {{/* TODO(kdevo): Make normalizing configurable */}} + {{ $image := .Resize "x300" }} + {{ $scratch.Set "img" $image.Permalink }} + {{/* $preview := .Fit "50x50 q25" */}} + {{/* $scratch.Set "imgPreview" $preview.Permalink */}} + {{- else -}} + {{ $scratch.Set "img" (. | absURL) }} + {{- end }} {{- else -}} - {{ with .Params.image -}} - {{ $scratch.Set "img" (printf "%s/%s" ("images" | relURL) .) }} + {{ with .Params.imageUrl }} + {{ $scratch.Set "img" (. | absURL) }} {{- else -}} {{ with .Params.github.repo -}} {{ $scratch.Set "img" ((printf "https://raw.githubusercontent.com/%s/master/.github/logo.png" .) | absURL) }} {{- end }} {{- end }} {{- end }} -<img {{ if .Site.Params.Feat.lazyLoading }} -data-src="{{ $scratch.Get "img" }}" class="lazyload" -{{ else }}src="{{ $scratch.Get "img" }}"{{ end }} +<img +{{ if .Site.Params.Feat.lazyLoading }} +data-src="{{ $scratch.Get "img" }}" class="lazyload" src="{{ $scratch.Get "imgPreview" }}" +{{ else }} +src="{{ $scratch.Get "img" }}" +{{ end }} {{ if .Params.alt }}alt="{{ .Params.alt }}"{{ end }}>
\ No newline at end of file |