mirror of https://github.com/jpanther/congo.git
30 lines
941 B
HTML
30 lines
941 B
HTML
{{ if .Get "default" }}
|
|
{{ template "_internal/shortcodes/figure.html" . }}
|
|
{{ else }}
|
|
{{ $url := urls.Parse (.Get "src") }}
|
|
{{ $altText := .Get "alt" }}
|
|
{{ $caption := .Get "caption" }}
|
|
{{ $href := .Get "href" }}
|
|
{{ $class := .Get "class" }}
|
|
|
|
{{ $file := $url.Path }}
|
|
{{ $img := .Page.Resources.GetMatch $file }}
|
|
{{- if and (not $img) .Page.File }}
|
|
{{ $path := path.Join .Page.File.Dir $file }}
|
|
{{ $img = resources.Get $path }}
|
|
{{ end -}}
|
|
|
|
<figure{{ with $class }} class="{{ . }}"{{ end }}>
|
|
{{ with $href }}<a href="{{ . }}">{{ end }}
|
|
|
|
{{- with $img -}}
|
|
{{ partial "picture.html" (dict "img" . "alt" $altText "class" $class) }}
|
|
{{- else -}}
|
|
<img src="{{ $url.String }}" alt="{{ $altText }}" class="{{ $class }}"/>
|
|
{{- end -}}
|
|
|
|
{{ with $href }}</a>{{ end }}
|
|
{{ with $caption }}<figcaption class="text-center">{{ . | markdownify }}</figcaption>{{ end }}
|
|
</figure>
|
|
{{ end }}
|