mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-09-11 01:25:32 -04:00
render all image tags as figures
This commit is contained in:
@@ -28,20 +28,15 @@ div#content {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.image,
|
|
||||||
figure {
|
figure {
|
||||||
|
margin: 1em auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
height: auto;
|
height: auto;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
figure {
|
|
||||||
margin: 1em auto;
|
|
||||||
|
|
||||||
// image captions
|
|
||||||
figcaption {
|
figcaption {
|
||||||
font-size: 0.95em;
|
font-size: 0.95em;
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +1,17 @@
|
|||||||
{{- $optimized := partial "functions/optimize-image" . -}}
|
{{- $optimized := partial "functions/optimize-image" . -}}
|
||||||
|
|
||||||
{{- with .Inner }}
|
|
||||||
<figure>
|
<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 }}
|
{{ 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 }}"
|
<img src="{{ $optimized.Permalink }}" width="{{ $optimized.Width }}" height="{{ $optimized.Height }}"
|
||||||
{{- with .Get "alt" }} alt="{{ . | safeHTML }}" title="{{ . | safeHTML }}"{{ end }}>
|
{{- 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 }}
|
{{ if .Get "link" }}</a>{{ end }}
|
||||||
</p>
|
|
||||||
{{- end }}
|
{{ with .Inner -}}
|
||||||
|
<figcaption>{{ . | $.Page.RenderString | safeHTML }}</figcaption>
|
||||||
|
{{- end }}
|
||||||
|
</figure>
|
||||||
|
|||||||
Reference in New Issue
Block a user