commit ca17f520f8f9dc4bd3b54d4cb8f7e4c9060a16da
parent a7cf533472929e3e3d5ca94bc0ec7e1ed0e9f46e
Author: Lou Woell <lou.woell@posteo.de>
Date: Wed, 5 Feb 2025 19:58:19 +0100
Add video shortcode
Diffstat:
4 files changed, 40 insertions(+), 2 deletions(-)
diff --git a/assets/css/main.scss b/assets/css/main.scss
@@ -98,7 +98,8 @@ figure {
margin: 25px 0;
&.left {
- margin-right: auto;
+ margin-right: 25px;
+ float: left;
}
&.center {
@@ -107,7 +108,8 @@ figure {
}
&.right {
- margin-left: auto;
+ margin-left: 25px;
+ float: right;
}
figcaption {
diff --git a/assets/css/style.scss b/assets/css/style.scss
@@ -19,6 +19,8 @@
@import "tabbedContainer";
+@import "video";
+
.post-on-list-content-preview {
display: grid;
column-gap: 2em;
diff --git a/assets/css/video.scss b/assets/css/video.scss
@@ -0,0 +1,7 @@
+video {
+ display: block;
+ max-width: 100%;
+ max-height: 100%;
+ margin-left: auto;
+ margin-right: auto;
+}
diff --git a/layouts/shortcodes/video.html b/layouts/shortcodes/video.html
@@ -0,0 +1,27 @@
+{{ if .Get "src" }}
+ <figure class="{{ with .Get "position"}}{{ . }}{{ else -}} left {{- end }}"
+ style="{{- with .Get "width" -}} width:{{ . }}; {{- end -}}">
+ <video controls>
+ <source src="{{ .Get "src"}}">
+ <p>
+ Your Browser doesn't support html video. Here's a
+ <a href="{{ .Get "src"}}" download="{{ .Get "src"}}">
+ direct link
+ </a>
+ to the video.
+ </p>
+ </video>
+ {{ if .Get "caption" }}
+ <figcaption
+ class="
+ {{ with .Get "captionPosition"}}{{ . }}
+ {{ else -}} center
+ {{- end }}"
+ {{ with .Get "captionStyle" }}
+ style="{{ . | safeCSS }}"
+ {{ end }}>
+ {{ .Get "caption" | safeHTML }}
+ </figcaption>
+ {{ end }}
+ </figure>
+{{ end }}