mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-03 13:46:38 -04:00
render all image tags as figures
This commit is contained in:
@ -28,20 +28,15 @@ div#content {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
p.image,
|
||||
figure {
|
||||
margin: 1em auto;
|
||||
text-align: center;
|
||||
|
||||
img {
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
figure {
|
||||
margin: 1em auto;
|
||||
|
||||
// image captions
|
||||
figcaption {
|
||||
font-size: 0.95em;
|
||||
|
||||
|
@ -1,21 +1,17 @@
|
||||
{{- $optimized := partial "functions/optimize-image" . -}}
|
||||
|
||||
{{- with .Inner }}
|
||||
<figure>
|
||||
{{ with $.Get "link" }}<a class="no-underline" href="{{ . }}"{{ if strings.HasPrefix . "http" }} target="_blank" rel="noopener"{{ end }}>{{ end }}
|
||||
<picture>
|
||||
<img src="{{ $optimized.Permalink }}" loading="lazy" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
|
||||
alt="{{ . | $.Page.RenderString | plainify | safeHTML }}" title="{{ . | $.Page.RenderString | plainify | safeHTML }}">
|
||||
</picture>
|
||||
{{ if $.Get "link" }}</a>{{ end }}
|
||||
|
||||
<figcaption>{{ . | $.Page.RenderString | safeHTML }}</figcaption>
|
||||
</figure>
|
||||
{{- else }}
|
||||
<p class="image">
|
||||
{{ with .Get "link" }}<a class="no-underline" href="{{ . }}"{{ if strings.HasPrefix . "http" }} target="_blank" rel="noopener"{{ end }}>{{ end }}
|
||||
<img src="{{ $optimized.Permalink }}" loading="lazy" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
|
||||
{{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}>
|
||||
<img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
|
||||
{{- with .Inner }}
|
||||
alt="{{ . | $.Page.RenderString | plainify | safeHTML }}" title="{{ . | $.Page.RenderString | plainify | safeHTML }}"
|
||||
{{- else }}
|
||||
{{ with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}
|
||||
{{- end -}}
|
||||
>
|
||||
{{ if .Get "link" }}</a>{{ end }}
|
||||
</p>
|
||||
{{- end }}
|
||||
|
||||
{{ with .Inner -}}
|
||||
<figcaption>{{ . | $.Page.RenderString | safeHTML }}</figcaption>
|
||||
{{- end }}
|
||||
</figure>
|
||||
|
Reference in New Issue
Block a user