feat: video galleries
This commit is contained in:
parent
5a1e4fc252
commit
ff9c90f68b
2 changed files with 44 additions and 19 deletions
|
@ -9,4 +9,18 @@
|
|||
grid-column-end: -1;
|
||||
grid-column-start: 1;
|
||||
}
|
||||
|
||||
& .figure {
|
||||
margin-trim: unset;
|
||||
|
||||
@supports not (margin-trim: block) {
|
||||
&:first-child {
|
||||
margin-block-start: 16px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-block-end: unset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
|
||||
{{- with (.Get "dir") -}}
|
||||
<!-- If a directory was specified, generate figures for all of the images in the directory -->
|
||||
{{- $images := $.Page.Resources.Match ( print . "/*" ) }}
|
||||
{{- range $images -}}
|
||||
{{- $resources := $.Page.Resources.Match ( print . "/*" ) }}
|
||||
{{- range $resources -}}
|
||||
{{- $caption := .Name | replaceRE "\\..*" "" | humanize }}<!-- humanized filename without extension -->
|
||||
{{- $linkURL := print $.Page.Permalink ($.Get "dir") "/" .Name | absURL }}<!-- absolute URL to hi-res image -->
|
||||
<figure class="figure gallery__figure" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
|
||||
<a href="{{ .RelPermalink }}" itemprop="contentUrl">
|
||||
{{- if eq .ResourceType "image" -}}
|
||||
<picture class="figure__picture"
|
||||
itemprop="image">
|
||||
<img itemprop="thumbnail"
|
||||
|
@ -36,6 +37,16 @@
|
|||
loading="lazy"
|
||||
>
|
||||
</picture>
|
||||
{{- else if eq .ResourceType "video" -}}
|
||||
{{- if eq .MediaType "video/ogg" -}}
|
||||
{{- partial "media/audio.html" . -}}
|
||||
|
||||
{{- else -}}
|
||||
{{- partial "media/video.html" ( dict "src" . "page_file_path" $.Page.File.Path ) -}}
|
||||
{{- end -}}
|
||||
{{- else if ( or ( ne .ResourceType "image" ) ( ne .ResourceType "video" ) ) -}}
|
||||
{{- errorf "No handling for resource of type %q" .ResourceType -}}
|
||||
{{- end -}}
|
||||
</a>
|
||||
{{- if or ( .Params.title ) ( .Params.attr ) -}}
|
||||
<figcaption class="figure__caption{{ if not .Params.title }} figure__caption--no-height{{ end }}">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue