Add styles for youtube figures
Bring over the youtube shortcode from the old theme, and add styles for the figures it creates. Add the .figure--youtube class to the <figure> element.
This commit is contained in:
parent
9baf615ebd
commit
e1ad32ab12
3 changed files with 27 additions and 1 deletions
|
@ -61,7 +61,7 @@ p + p {
|
||||||
|
|
||||||
/* Figures */
|
/* Figures */
|
||||||
|
|
||||||
{{- $elementsWithXLBlockMargins := "blockquote, .figure--image, .codeblock, .highlight" -}}
|
{{- $elementsWithXLBlockMargins := "blockquote, .figure--image, .figure--youtube, .codeblock, .highlight" -}}
|
||||||
|
|
||||||
p + :is({{ $elementsWithXLBlockMargins }}) {
|
p + :is({{ $elementsWithXLBlockMargins }}) {
|
||||||
margin-block-start: var(--space-xl);
|
margin-block-start: var(--space-xl);
|
||||||
|
|
|
@ -17,6 +17,20 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.figure--youtube {
|
||||||
|
grid-column: main-start / main-end;
|
||||||
|
|
||||||
|
.youtube {
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
aspect-ratio: 16 / 9;
|
||||||
|
margin-bottom: -3px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
figcaption {
|
figcaption {
|
||||||
color: var(--text-color-secondary);
|
color: var(--text-color-secondary);
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
|
12
layouts/shortcodes/youtube.html
Normal file
12
layouts/shortcodes/youtube.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{{- $pc := .Page.Site.Config.Privacy.YouTube -}}
|
||||||
|
{{- if not $pc.Disable -}}
|
||||||
|
{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}}
|
||||||
|
{{- $id := .Get "id" | default (.Get 0) -}}
|
||||||
|
{{- $class := .Get "class" | default (.Get 1) -}}
|
||||||
|
{{- $title := .Get "title" | default "YouTube Video" }}
|
||||||
|
<figure class="figure--youtube{{ with $class }} {{ . }}{{ end }}">
|
||||||
|
<div class="youtube">
|
||||||
|
<iframe src="https://{{ $ytHost }}/embed/{{ $id }}{{ with .Get "autoplay" }}{{ if eq . "true" }}?autoplay=1{{ end }}{{ end }}" allowfullscreen frameborder=0 title="{{ $title }}"></iframe>
|
||||||
|
</div>
|
||||||
|
</figure>
|
||||||
|
{{ end -}}
|
Loading…
Add table
Add a link
Reference in a new issue