File tree Expand file tree Collapse file tree 3 files changed +24
-9
lines changed Expand file tree Collapse file tree 3 files changed +24
-9
lines changed Original file line number Diff line number Diff line change 3
3
< h1 > {{ .Title }}</ h1 >
4
4
5
5
{{ range $index, $project := sort .Pages ".Params.date_end" "desc" }}
6
+
6
7
{{ $img := ( .Resources.GetMatch .Params.featured_image ) }}
7
- {{ $img = $img.Resize "200x webp drawing" }}
8
+ {{ if not $img }}
9
+ {{ $img = resources.Get .Params.featured_image }}
10
+ {{ if not $img }}
11
+ {{ $img = resources.Get "images/project-default.png" }}
12
+ {{ end }}
13
+ {{ end }}
14
+
8
15
< section class ="mt-5 ">
9
16
< header class ="mb-2 ">
10
17
< h2 >
15
22
< p > {{ .Params.date_start | time.Format "Jan 2006" }} — {{ .Params.date_end | time.Format "Jan 2006" }}</ p >
16
23
</ header >
17
24
< div class ="clearfix ">
18
- < a href ="{{ .Permalink }} " class ="">
19
- < img src ="{{ $img.Permalink }} " alt ="{{ $project.Title }} logo " class ="float-md-start me-3 mb-2 " height ="{{ $img.Height }} " width ="{{ $img.Width }} " style ="max-width:min(200px, 100vw); ">
20
- </ a >
25
+ {{ if $img }}
26
+ {{ $img = $img.Resize "200x webp drawing" }}
27
+ < a href ="{{ .Permalink }} " class ="">
28
+ < img src ="{{ $img.Permalink }} " alt ="{{ $project.Title }} logo " class ="float-md-start me-3 mb-2 " height ="{{ $img.Height }} " width ="{{ $img.Width }} " style ="max-width:min(200px, 100vw); ">
29
+ </ a >
30
+ {{ end }}
21
31
< p class ="mx-1 text-justify "> {{ .Params.summary | markdownify }}</ p >
22
32
</ div >
23
33
</ section >
Original file line number Diff line number Diff line change 1
1
{{ define "main" }}
2
2
3
-
3
+ {{ $img := ( .Resources.GetMatch .Params.featured_image ) }}
4
+ {{ if not $img }}
5
+ {{ $img = resources.Get .Params.featured_image }}
6
+ {{ end }}
4
7
5
8
6
9
< main class ="flex-fill container post my-4 " aria-role ="main ">
@@ -16,10 +19,12 @@ <h2>{{ .Title }}</h2>
16
19
17
20
< article class ="mt-4 ">
18
21
< header class ="mb-4 ">
19
- < div >
20
- {{ $img := ( .Resources.GetMatch .Params.featured_image ).Resize "200x" }}
21
- < img src ="{{ $img.Permalink }} " alt ="{{ .Title }} logo " class ="me-3 mb-2 " height ="{{ $img.Height }} " width ="{{ $img.Width }} " style ="max-width:min(200px, 100vw); " />
22
- </ div >
22
+ {{ if $img }}
23
+ {{ $img = $img.Resize "200x webp drawing" }}
24
+ < div >
25
+ < img src ="{{ $img.Permalink }} " alt ="{{ .Title }} logo " class ="me-3 mb-2 " height ="{{ $img.Height }} " width ="{{ $img.Width }} " style ="max-width:min(200px, 100vw); " />
26
+ </ div >
27
+ {{ end }}
23
28
< div >
24
29
< h1 > {{ .Title }}</ h1 >
25
30
< p >
You can’t perform that action at this time.
0 commit comments