hugo-theme-termlite/layouts/partials/page/figures/fullwidth.html
Eryn Wells efae2acdea Simplify figure styles and markup
Remove the .figure__container element. According to Tess, putting a <figcaption>
inside a child of a <figure> "doesn't obey the content model" or some shit.
Fiiiiine.

Getting small figures to lay out the way I want them to without the container
was a bit of a trick. Instead of letting the figure span the entire width of the
grid column, let it fit the size of its contents, and then set margin-inline to
auto so it centers.

Doing this also allowed me to remove the .figure--image, etc styles because the
styles and markup are a lot more similar among figures containing different
kinds of elements. Nice!
2024-11-25 15:48:04 -08:00

10 lines
442 B
HTML

{{- $resource := .page.Resources.GetMatch .name -}}
{{- if not $resource }}
{{ errorf "No resource named '%s'. %s" .name .page.Permalink }}
{{ end -}}
{{- if eq $resource.ResourceType "image" -}}
{{ partial "page/figures/fullwidth-image.html" (merge . (dict "resource" $resource)) }}
{{- else if eq $resource.ResourceType "video" -}}
{{ partial "page/figures/fullwidth-video.html" (merge . (dict "resource" $resource)) }}
{{- end -}}