@@ -21,12 +21,12 @@ aliases: "/examples/"
21
21
{{ range $i, $example := $entry.examples -}}
22
22
{{- $len := len $entry.examples -}}
23
23
{{ if (eq $i 0) }}<div class =" row " >{{ end }}
24
- {{ if $entry.external }}
24
+ {{ if $entry.external - }}
25
25
<div class =" col-md-6 col-lg-4 mb-3 d-flex gap-3 " >
26
26
<svg class =" bi fs-5 flex-shrink-0 mt-1 " ><use xlink:href =" #box-seam " ></use ></svg >
27
27
<div >
28
28
<h3 class =" h5 mb-1 " >
29
- <a class =" d-block link-offset-1 " href =" {{ $.Site.Params.github_org }}{{ $example.url }}/ " target =" _blank " rel =" noopener " >
29
+ <a class =" d-block link-offset-1 " href =" {{ urls.JoinPath $.Site.Params.github_org $example.url }} " target =" _blank " rel =" noopener " >
30
30
{{ $example.name }}
31
31
</a >
32
32
</h3 >
@@ -43,23 +43,29 @@ aliases: "/examples/"
43
43
</p >
44
44
</div >
45
45
</div >
46
- {{ else }}
46
+ {{ else - }}
47
47
<div class =" col-sm-6 col-md-3 mb-3 " >
48
- <a class="d-block link-offset-1" href="/docs/{{ $.Site.Params.docs_version }}/examples/{{ $example.name | urlize }}/"{{ if in $example.name "RTL" }} hreflang="ar"{{ end }}>
49
- <img class="img-thumbnail mb-3" srcset="/docs/{{ $.Site.Params.docs_version }}/assets/img/examples/{{ $example.name | urlize }}.png,
50
- /docs/{{ $.Site.Params.docs_version }}/assets/img/examples/{{ $example.name | urlize }}@2x .png 2x"
51
- src="/docs/{{ $.Site.Params.docs_version }}/assets/img/examples/{{ $example.name | urlize }}.png"
52
- alt=""
53
- width="480" height="300"
54
- loading="lazy">
48
+ <a class="d-block link-offset-1" href="{{ urls.JoinPath "/docs" $.Site.Params.docs_version "/examples" ($example.name | urlize) "/"}}"{{ if in $example.name "RTL" }} hreflang="ar"{{ end }}>
49
+ {{ $imageBasePath := urls.JoinPath "/docs" $.Site.Params.docs_version "assets/img/examples" -}}
50
+ {{- $imgPath := urls.JoinPath $imageBasePath (printf "%s%s" ($example.name | urlize) ".png") -}}
51
+ {{- $imgPath2x := urls.JoinPath $imageBasePath (printf "%s%s" ($example.name | urlize) "@2x .png") -}}
52
+ {{- with (imageConfig (path.Join "/site/static" $imgPath)) -}}
53
+ <img class="img-thumbnail mb-3"
54
+ srcset="{{ $imgPath }}, {{ $imgPath2x }} 2x"
55
+ src="{{ $imgPath }}"
56
+ alt=""
57
+ width="{{ .Width }}"
58
+ height="{{ .Height }}"
59
+ loading="lazy">
60
+ {{- end }}
55
61
<h3 class =" h5 mb-1 " >
56
62
{{ $example.name }}
57
63
</h3 >
58
64
</a >
59
65
<p class =" text-body-secondary " >{{ $example.description }}</p >
60
66
</div >
61
- {{ end }}
62
- {{ if (eq (add $i 1) $len) }}</div >{{ end }}
67
+ {{- end }}
68
+ {{ if (eq (add $i 1) $len) }}</div >{{ end - }}
63
69
{{ end -}}
64
70
</div >
65
71
{{ end -}}
0 commit comments