File tree 3 files changed +23
-15
lines changed
3 files changed +23
-15
lines changed Original file line number Diff line number Diff line change 10
10
</ h2 >
11
11
</ header >
12
12
{{ $link := .RelPermalink }}
13
- {{ with partial "functions/feature-image" . }}
13
+ {{ with partial "functions/feature-image" (dict "context" . "fallbackGlobal" false "preferOriginal" false) }}
14
14
< a href ="{{ $link }} " class ="thumbnail-link ">
15
15
< img class ="thumbnail " src ="{{ . }} ">
16
16
</ a >
Original file line number Diff line number Diff line change
1
+ {{ $fallbackGlobal := .fallbackGlobal }}
2
+ {{ $preferOriginal := .preferOriginal }}
1
3
{{ $image := false }}
2
- {{ with .Params.images }}
3
- {{ $image = index . 0 | relURL }}
4
- {{ else }}
5
- {{ $images := .Resources.ByType "image" }}
6
- {{ $featured := $images.GetMatch "*feature*" }}
7
- {{ $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") }}
8
- {{ with $featured }}
9
- {{ if gt $featured.Width 720 }}
10
- {{ $featured = $featured.Resize "720x" }}
11
- {{ end }}
12
- {{ $image = $featured.RelPermalink }}
4
+ {{ with .context }}
5
+ {{ with .Params.images }}
6
+ {{ $image = index . 0 | relURL }}
13
7
{{ else }}
14
- {{ with .Site.Params.images }}
15
- {{ $image = index . 0 | relURL }}
8
+ {{ $images := .Resources.ByType "image" }}
9
+ {{ $featured := $images.GetMatch "*feature*" }}
10
+ {{ $featured := cond (ne $featured nil) $featured ($images.GetMatch "{*cover*,*thumbnail*}") }}
11
+ {{ with $featured }}
12
+ {{ if not $preferOriginal }}
13
+ {{ if gt $featured.Width 720 }}
14
+ {{ $featured = $featured.Resize "720x" }}
15
+ {{ end }}
16
+ {{ end }}
17
+ {{ $image = $featured.RelPermalink }}
18
+ {{ else }}
19
+ {{ if $fallbackGlobal }}
20
+ {{ with .Site.Params.images }}
21
+ {{ $image = index . 0 | relURL }}
22
+ {{ end }}
23
+ {{ end }}
16
24
{{ end }}
17
25
{{ end }}
18
26
{{ end }}
Original file line number Diff line number Diff line change 21
21
< meta name ="og:description " content ="{{ .Summary }} ">
22
22
{{ end }}
23
23
< meta property ="og:url " content ="{{ .Permalink }} ">
24
- {{ with partial "functions/feature-image" . }}
24
+ {{ with partial "functions/feature-image" (dict "context" . "fallbackGlobal" true "preferOriginal" true) }}
25
25
< meta property ="og:image " content ="{{ . | absURL }} ">
26
26
{{ end }}
You can’t perform that action at this time.
0 commit comments