mirror of https://github.com/istio/istio.io.git
Another experiment for image links.
This commit is contained in:
parent
1811057b0d
commit
61a4a6a2ec
|
@ -32,19 +32,21 @@ parameter.
|
|||
{{ $alt := or (.Get "alt") (.Get "title") (.Get "caption") }}
|
||||
|
||||
{{/* Turn relative values for $link into absolute URLs */}}
|
||||
{{ .Scratch.Set "link" $link }}
|
||||
|
||||
{{ $prefix := slicestr $link 0 1 }}
|
||||
{{ if (eq $prefix "/") }}
|
||||
{{ .Scratch.Set "link" $link }}
|
||||
{{ else }}
|
||||
{{ if (ne $prefix "/") }}
|
||||
{{ $prefix := slicestr $link 0 8 }}
|
||||
{{ if (ne $prefix "https://") }}
|
||||
{{ $prefix := slicestr $link 0 3 }}
|
||||
{{ if (eq $prefix "../") }}
|
||||
{{ $link := slicestr $link 3 }}
|
||||
{{ .Scratch.Set "link" (printf "/%s%s" .Page.Dir $link) }}
|
||||
{{ .Scratch.Set "link" (printf "/%s%s" .Page.Dir (slicestr $link 3)) }}
|
||||
{{ else }}
|
||||
{{ .Scratch.Set "link" (printf "/%s%s" .Page.Dir $link) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $link := printf "%s%s" .Site.BaseURL (.Scratch.Get "link") }}
|
||||
{{ $link := .Scratch.Get "link" }}
|
||||
|
||||
<figure style="width: {{ $width }}">
|
||||
<div class="wrapper-with-intrinsic-ratio" style="padding-bottom: {{ $ratio }}">
|
||||
|
|
Loading…
Reference in New Issue