File tree Expand file tree Collapse file tree 6 files changed +88
-29
lines changed Expand file tree Collapse file tree 6 files changed +88
-29
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,15 @@ categories: []
1818hiddenFromHomePage : false
1919hiddenFromSearch : false
2020
21- featuredImage : " "
22- featuredImagePreview : " "
21+ # Direct image path (string)
22+ # featuredImage: ""
23+ # featuredImagePreview: ""
24+ # Hugo Page Bundle resource (object), recommended for advanced image processing.
25+ resources :
26+ - name : " featured-image"
27+ src : " "
28+ - name : " featured-image-preview"
29+ src : " "
2330
2431toc :
2532 enable : true
Original file line number Diff line number Diff line change @@ -64,11 +64,38 @@ <h3 class="related-title">{{ T "relatedContent" | default "See Also" }}</h3>
6464 < div class ="related-posts ">
6565 {{- range . -}}
6666 < a class ="related-post " href ="{{ .RelPermalink }} ">
67- {{- $featured := .Resources.Get "featured-image" -}}
68- {{- if $featured -}}
69- {{- $image := $featured.Fill "68x68 Center q100 Lanczos" -}}
67+ {{- $image := "" -}}
68+ {{- with .Params.featuredimagepreview | default .Params.featuredImagePreview -}}
69+ {{- $image = . | relURL -}}
70+ {{- else -}}
71+ {{- with .Resources.GetMatch "featured-image-preview" -}}
72+ {{- $image = (.Fill "68x68 Center q100 Lanczos").RelPermalink -}}
73+ {{- else -}}
74+ {{- range .Params.resources -}}
75+ {{- if eq .name "featured-image-preview" -}}
76+ {{- $image = .src | relURL -}}
77+ {{- end -}}
78+ {{- end -}}
79+ {{- end -}}
80+ {{- end -}}
81+ {{- if not $image -}}
82+ {{- with .Params.featuredimage | default .Params.featuredImage -}}
83+ {{- $image = . | relURL -}}
84+ {{- else -}}
85+ {{- with .Resources.GetMatch "featured-image" -}}
86+ {{- $image = (.Fill "68x68 Center q100 Lanczos").RelPermalink -}}
87+ {{- else -}}
88+ {{- range .Params.resources -}}
89+ {{- if eq .name "featured-image" -}}
90+ {{- $image = .src | relURL -}}
91+ {{- end -}}
92+ {{- end -}}
93+ {{- end -}}
94+ {{- end -}}
95+ {{- end -}}
96+ {{- if $image -}}
7097 < div class ="related-post-image ">
71- < img src ="{{ $image.RelPermalink }} " alt ="{{ .Title }} " loading ="lazy ">
98+ < img src ="{{ $image }} " alt ="{{ .Title }} " loading ="lazy ">
7299 </ div >
73100 {{- else -}}
74101 < div class ="related-post-image-placeholder ">
Original file line number Diff line number Diff line change @@ -22,17 +22,14 @@ <h2 class="toc-title">{{ T "contents" }}</h2>
2222
2323 {{- /* Featured image */ -}}
2424 {{- $image := "" -}}
25- {{- with .Params.featuredimage -}}
25+ {{- with .Params.featuredimage | default .Params.featuredImage -}}
2626 {{- $image = . | relURL -}}
2727 {{- else -}}
28- {{- $imageResource := .Resources.GetMatch "featured-image" -}}
29- {{- with $imageResource -}}
28+ {{- with .Resources.GetMatch "featured-image" -}}
3029 {{- $image = .RelPermalink -}}
3130 {{- else -}}
3231 {{- range .Params.resources -}}
33- {{- if eq .name "featured-image" -}}
34- {{- $image = .src | relURL -}}
35- {{- end -}}
32+ {{- if eq .name "featured-image" -}}{{- $image = .src | relURL -}}{{- end -}}
3633 {{- end -}}
3734 {{- end -}}
3835 {{- end -}}
Original file line number Diff line number Diff line change @@ -23,16 +23,26 @@ <h3 class="group-title">{{ .Key }}</h3>
2323 < div class ="timeline ">
2424 < div class ="circle ">
2525 {{- $image := "" -}}
26- {{- with .Params.featuredimage -}}
26+ {{- with .Params.featuredimagepreview | default .Params.featuredImagePreview -}}
2727 {{- $image = . | relURL -}}
2828 {{- else -}}
29- {{- $imageResource := .Resources.GetMatch "featured-image" -}}
30- {{- with $imageResource -}}
29+ {{- with .Resources.GetMatch "featured-image-preview" -}}
3130 {{- $image = (.Fill "68x68 Center q100 Lanczos").RelPermalink -}}
3231 {{- else -}}
3332 {{- range .Params.resources -}}
34- {{- if eq .name "featured-image" -}}
35- {{- $image = .src | relURL -}}
33+ {{- if eq .name "featured-image-preview" -}}{{- $image = .src | relURL -}}{{- end -}}
34+ {{- end -}}
35+ {{- end -}}
36+ {{- end -}}
37+ {{- if not $image -}}
38+ {{- with .Params.featuredimage | default .Params.featuredImage -}}
39+ {{- $image = . | relURL -}}
40+ {{- else -}}
41+ {{- with .Resources.GetMatch "featured-image" -}}
42+ {{- $image = (.Fill "68x68 Center q100 Lanczos").RelPermalink -}}
43+ {{- else -}}
44+ {{- range .Params.resources -}}
45+ {{- if eq .name "featured-image" -}}{{- $image = .src | relURL -}}{{- end -}}
3646 {{- end -}}
3747 {{- end -}}
3848 {{- end -}}
Original file line number Diff line number Diff line change 77 {{- /* Featured image */ -}}
88 {{- if .Site.Params.home.posts.imagePreview -}}
99 {{- $image := "" -}}
10- {{- with .Params.featuredimagepreview -}}
10+ {{- with .Params.featuredimagepreview | default .Params.featuredImagePreview -}}
1111 {{- $image = . | relURL -}}
1212 {{- else -}}
13- {{- with .Params.featuredimage -}}
13+ {{- with .Resources.GetMatch "featured-image-preview" -}}
14+ {{- $image = .RelPermalink -}}
15+ {{- else -}}
16+ {{- range .Params.resources -}}
17+ {{- if eq .name "featured-image-preview" -}}{{- $image = .src | relURL -}}{{- end -}}
18+ {{- end -}}
19+ {{- end -}}
20+ {{- end -}}
21+
22+ {{- if not $image -}}
23+ {{- with .Params.featuredimage | default .Params.featuredImage -}}
1424 {{- $image = . | relURL -}}
1525 {{- else -}}
16- {{- $imageResource := .Resources.GetMatch "featured-image-preview" | default (.Resources.GetMatch "featured-image") -}}
17- {{- with $imageResource -}}
26+ {{- with .Resources.GetMatch "featured-image" -}}
1827 {{- $image = .RelPermalink -}}
1928 {{- else -}}
2029 {{- range .Params.resources -}}
21- {{- if or (eq .name "featured-image-preview") (eq .name "featured-image") -}}
22- {{- $image = .src | relURL -}}
23- {{- end -}}
30+ {{- if eq .name "featured-image" -}}{{- $image = .src | relURL -}}{{- end -}}
2431 {{- end -}}
2532 {{- end -}}
2633 {{- end -}}
2734 {{- end -}}
35+
2836 {{- with $image -}}
2937 < div class ="featured-image-preview ">
3038 < a href ="{{ $.RelPermalink }} ">
Original file line number Diff line number Diff line change @@ -30,16 +30,26 @@ <h3 class="group-title">{{ .Key }}</h3>
3030 < div class ="timeline ">
3131 < div class ="circle ">
3232 {{- $image := "" -}}
33- {{- with .Params.featuredimage -}}
33+ {{- with .Params.featuredimagepreview | default .Params.featuredImagePreview -}}
3434 {{- $image = . | relURL -}}
3535 {{- else -}}
36- {{- $imageResource := .Resources.GetMatch "featured-image" -}}
37- {{- with $imageResource -}}
36+ {{- with .Resources.GetMatch "featured-image-preview" -}}
3837 {{- $image = (.Fill "68x68 Center q100 Lanczos").RelPermalink -}}
3938 {{- else -}}
4039 {{- range .Params.resources -}}
41- {{- if eq .name "featured-image" -}}
42- {{- $image = .src | relURL -}}
40+ {{- if eq .name "featured-image-preview" -}}{{- $image = .src | relURL -}}{{- end -}}
41+ {{- end -}}
42+ {{- end -}}
43+ {{- end -}}
44+ {{- if not $image -}}
45+ {{- with .Params.featuredimage | default .Params.featuredImage -}}
46+ {{- $image = . | relURL -}}
47+ {{- else -}}
48+ {{- with .Resources.GetMatch "featured-image" -}}
49+ {{- $image = (.Fill "68x68 Center q100 Lanczos").RelPermalink -}}
50+ {{- else -}}
51+ {{- range .Params.resources -}}
52+ {{- if eq .name "featured-image" -}}{{- $image = .src | relURL -}}{{- end -}}
4353 {{- end -}}
4454 {{- end -}}
4555 {{- end -}}
You can’t perform that action at this time.
0 commit comments