various updates
This commit is contained in:
parent
4955708f0e
commit
ee87009471
37 changed files with 1734 additions and 401 deletions
|
@ -3,12 +3,12 @@
|
|||
{{- end -}}
|
||||
|
||||
{{ $src := $.Page.Resources.GetMatch (.Get "src") }}
|
||||
{{ if ( not $src ) }}
|
||||
{{ if ( and ( not $src ) ( not ( .Get "chart-id" ) ) ) }}
|
||||
{{- errorf "No Page Resource found for src '%v' for post '%v'" ( .Get "src" ) $.File.Path -}}
|
||||
{{ end }}
|
||||
{{ $linkedResource := $.Page.Resources.GetMatch (.Get "link") }}
|
||||
|
||||
<figure class="article__figure{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
<figure class="article__figure figure{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
{{- with .Get "chart-id" -}}
|
||||
<canvas class="figure__chart" id="{{ . }}">
|
||||
You must enable Javascript to view this chart.
|
||||
|
@ -18,56 +18,57 @@
|
|||
{{- if $linkedResource }}
|
||||
<a href="{{ $linkedResource.RelPermalink }}"{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||
{{ else }}
|
||||
<a
|
||||
href="{{ .Get "link" }}"
|
||||
{{- with .Get "target" -}}
|
||||
target="{{ . }}"
|
||||
{{- else -}}
|
||||
{{ warnf "No target defined for non-page resource link %q" ( .Get "link" ) -}}
|
||||
{{- end -}}
|
||||
{{- with .Get "rel" -}}
|
||||
rel="{{ . }}"
|
||||
{{- else -}}
|
||||
{{- warnf "No rel defined for non-page resource link %q" ( .Get "link" ) -}}
|
||||
{{- end -}}
|
||||
>
|
||||
<a href="{{ .Get "link" }}">
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if eq $src.ResourceType "image" -}}
|
||||
<picture class="figure__picture">
|
||||
<img class="figure__image"
|
||||
<picture class="figure__picture"
|
||||
itemprop="image">
|
||||
<img class="u-photo figure__image"
|
||||
{{ if ( or ( eq $src.MediaType.SubType "svg" ) ( eq $src.MediaType.SubType "gif" ) ) }}
|
||||
src="{{ $src.RelPermalink }}"
|
||||
{{ else }}
|
||||
{{ with $src.Resize "1500x webp" }}
|
||||
{{ with $src.Resize "1200x webp" }}
|
||||
src="{{ .RelPermalink }}"
|
||||
{{ end }}
|
||||
width="{{ $src.Width }}"
|
||||
height="{{ $src.Height }}"
|
||||
{{ end }}
|
||||
{{- if or ($src.Params.alt) (.Get "caption") }}
|
||||
alt="{{ with $src.Params.alt }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}"
|
||||
{{- with $src.Params.alt }}
|
||||
alt="{{ . }}"
|
||||
{{- end -}}
|
||||
{{- with $src.Params.title }} title="{{ . }}"{{ end -}}
|
||||
{{- with $src.Params.title }} title="{{ . }}" {{ end -}}
|
||||
loading="lazy"
|
||||
role="img"
|
||||
/>
|
||||
</picture>
|
||||
{{- else if eq $src.ResourceType "video" -}}
|
||||
{{- if eq $src.MediaType "video/ogg" -}}
|
||||
<audio class="figure__audio" controls>
|
||||
<audio class="u-audio figure__audio" itemprop="audio" controls>
|
||||
<source src="{{ $src.RelPermalink }}" type="{{ $src.MediaType }}" />
|
||||
<p>Your browser doesn't support embedded audio, but you can view the audio <a href="{{ $src.RelPermalink }}">here</a>.</p>
|
||||
<p>Your browser doesn't support embedded audio, <a href="{{ $src.RelPermalink }}">view the audio here</a>.</p>
|
||||
</audio>
|
||||
{{- else -}}
|
||||
<video class="figure__video"
|
||||
<video class="u-video figure__video"
|
||||
controls
|
||||
src="{{ $src.RelPermalink }}"
|
||||
poster="{{ if $src.Params.poster }}{{ .Get $src.Params.poster }}{{ else }}{{ warnf "No poster defined for resource %q" $src.RelPermalink }}{{ end }}"
|
||||
poster="
|
||||
{{- if $src.Params.poster -}}
|
||||
{{- $posterSrc := $.Page.Resources.GetMatch ( .Get $src.Params.poster ) -}}
|
||||
{{- with $posterSrc.Resize "1200x webp" -}}
|
||||
{{- .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- warnf "No poster defined for resource %q" $src.RelPermalink -}}
|
||||
{{- end -}}
|
||||
"
|
||||
itemprop="video"
|
||||
>
|
||||
Your browser doesn't support embedded video, but you can view the video <a href="{{ $src.RelPermalink }}">here</a>.
|
||||
Your browser doesn't support embedded video, <a href="{{ $src.RelPermalink }}">view the video here</a>.
|
||||
</video>
|
||||
{{- end -}}
|
||||
{{- else if or ( ne $src.ResourceType "image" ) ( ne $src.ResourceType "video" ) -}}
|
||||
{{- else if ( or ( ne $src.ResourceType "image" ) ( ne $src.ResourceType "video" ) ) -}}
|
||||
{{- errorf "No handling for resource of type %q" $src.ResourceType -}}
|
||||
{{- end -}}
|
||||
{{- if .Get "link" }}</a>{{ end -}}
|
||||
|
@ -77,20 +78,16 @@
|
|||
<figcaption class="figure__caption{{ if not ( or ( .Get "caption" ) ( .Get "title" ) ) }} figure__caption--no-height{{ end }}">
|
||||
{{- with $src -}}
|
||||
{{ if .Params.attrlink -}}
|
||||
<a class="figcaption__attrlink" href="{{ .Params.attrlink }}"
|
||||
{{- with .Params.attrtarget }} target="{{ . }}"{{ end -}}
|
||||
{{- with .Params.attrrel }} rel="{{ . }}"{{ end -}}
|
||||
>
|
||||
<a class="figcaption__attrlink" href="{{ .Params.attrlink }}">
|
||||
{{- end -}}
|
||||
{{- if .Params.attr -}}<p class="figcaption__attr">{{ .Params.attr | safeHTML }}{{ with .Params.attrlicence }} <span class="figcaption__licence">{{ . | safeHTML }}</span>{{ end }}</p>{{- end -}}
|
||||
{{- if .Params.attrlink -}}
|
||||
</a>
|
||||
{{- end -}}
|
||||
{{- with .Params.title -}}<h4 class="figcaption__title">{{ . }}</h4>{{- end -}}
|
||||
{{- end -}}
|
||||
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . }}</h4>{{- end -}}
|
||||
{{- with .Get "title" -}}<h4 class="figcaption__title">{{ . | markdownify | safeHTML }}</h4>{{- end -}}
|
||||
{{- with .Get "caption" -}}
|
||||
<p class="figcaption__caption">{{ . | markdownify }}</p>
|
||||
<p class="figcaption__caption">{{ . | markdownify | safeHTML }}</p>
|
||||
{{- end -}}
|
||||
</figcaption>
|
||||
{{- end -}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue