diff options
| author | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2022-03-27 18:44:06 +0530 |
|---|---|---|
| committer | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2022-03-27 18:44:06 +0530 |
| commit | 575cc0ca8c4e5904c7ae77e76db812c52e5f8ed1 (patch) | |
| tree | 29b83f765f6ccae88651886167681b4afdb71069 /layouts/partials/cover.html | |
| parent | 975972e04181007c61302054d18735dc440a0586 (diff) | |
Use `site` function instead of `.Site` or `$.Site`
- The site function provides global access to the same data as the .Site page method.
- Current context (`.`) is never considered.
Diffstat (limited to 'layouts/partials/cover.html')
| -rw-r--r-- | layouts/partials/cover.html | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/layouts/partials/cover.html b/layouts/partials/cover.html index b4e7c78..5c5f2fb 100644 --- a/layouts/partials/cover.html +++ b/layouts/partials/cover.html @@ -2,8 +2,8 @@ {{- if (and .Params.cover.image (not $.isHidden)) }} {{- $alt := (.Params.cover.alt | default .Params.cover.caption | plainify) }} <figure class="entry-cover"> - {{- $responsiveImages := (.Params.cover.responsiveImages | default .Site.Params.cover.responsiveImages) | default true }} - {{- $addLink := (and .Site.Params.cover.linkFullImages (not $.IsHome)) }} + {{- $responsiveImages := (.Params.cover.responsiveImages | default site.Params.cover.responsiveImages) | default true }} + {{- $addLink := (and site.Params.cover.linkFullImages (not $.IsHome)) }} {{- $cover := (.Resources.ByType "image").GetMatch (printf "*%s*" (.Params.cover.image)) }} {{- if $cover -}}{{/* i.e it is present in page bundle */}} {{- if $addLink }}<a href="{{ (path.Join .RelPermalink .Params.cover.image) | absURL }}" target="_blank" @@ -13,7 +13,7 @@ {{- if hugo.IsExtended -}} {{- $processableFormats = $processableFormats | append "webp" -}} {{- end -}} - {{- $prod := (hugo.IsProduction | or (eq .Site.Params.env "production")) }} + {{- $prod := (hugo.IsProduction | or (eq site.Params.env "production")) }} {{- if (and (in $processableFormats $cover.MediaType.SubType) ($responsiveImages) (eq $prod true)) }} <img loading="lazy" srcset="{{- range $size := $sizes -}} {{- if (ge $cover.Width $size) -}} |
