diff options
Diffstat (limited to 'themes/default/layouts/shortcodes')
31 files changed, 311 insertions, 163 deletions
diff --git a/themes/default/layouts/shortcodes/abbr.html b/themes/default/layouts/shortcodes/abbr.html index 0edff43..61a2e32 100644 --- a/themes/default/layouts/shortcodes/abbr.html +++ b/themes/default/layouts/shortcodes/abbr.html @@ -1,7 +1,8 @@ {{- $abbr := default "TL;DR:" (.Get "abbr" | default (.Get 0)) -}} {{- $title := default "Too long, didn't read" (.Get "title" | default (.Get 1)) -}} +{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $abbr)) .Ordinal -}} -{{- $id := delimit (shuffle (seq 0 20)) "" -}} -<input hidden type="checkbox" id="abbr-{{ $id }}" /> -<abbr title="{{ $title }}"><label for="abbr-{{ $id }}">{{ $abbr | markdownify }}</label></abbr> +<input hidden="" type="checkbox" id="abbr-{{ $hash }}" /> +{{- /* This comment removes trailing newlines and white spaces. */ -}} +<abbr title="{{ $title }}"><label for="abbr-{{ $hash }}">{{ $abbr | markdownify }}</label></abbr> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/animate.html b/themes/default/layouts/shortcodes/animate.html new file mode 100644 index 0000000..b245596 --- /dev/null +++ b/themes/default/layouts/shortcodes/animate.html @@ -0,0 +1,11 @@ +{{- $type := default "default" (.Get "type" | default (.Get 0)) -}} +{{- $text := default "animate" (.Get "text" | default (.Get 1)) -}} + +{{- $letters := split $text "" -}} + +<text-animation {{ $type }}=""> +{{- range $value, $letter := $letters -}} + <span style="--frame:{{ $value }}">{{ $letter }}</span> +{{- end -}} +</text-animation> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/animate.rss.xml b/themes/default/layouts/shortcodes/animate.rss.xml new file mode 100644 index 0000000..c1f04b8 --- /dev/null +++ b/themes/default/layouts/shortcodes/animate.rss.xml @@ -0,0 +1,5 @@ +{{- $type := default "default" (.Get "type" | default (.Get 0)) -}} +{{- $text := default "animate" (.Get "text" | default (.Get 1)) -}} + +<a title="{{ $type }} animation" href="{{ .Page.Permalink }}">{{ $text }}</a> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/attach.html b/themes/default/layouts/shortcodes/attach.html new file mode 100644 index 0000000..55b5744 --- /dev/null +++ b/themes/default/layouts/shortcodes/attach.html @@ -0,0 +1,58 @@ +{{- $url := default "/canory/media/2city12p.pdf" (.Get "url" | default (.Get 0)) -}} +{{- $title := default "Attachment" (.Get "title" | default (.Get 1)) -}} +{{- $caption := default $title (.Get "caption" | default (.Get 2)) -}} +{{- $remote := default "" (.Get "remote" | default (.Get 3)) -}} + +{{- $data := "" -}} +{{- $cache := "" -}} +{{- $author := .Page.Section -}} +{{- $extension := path.Ext $url -}} +{{- $immutable := print $url | anchorize -}} +{{- $localFile := path.Join "public/" $url -}} +{{- $type := "application/octet-stream" -}} +{{- $storage := print $author "/media/" $immutable $extension -}} +{{- $cached := fileExists (path.Join "public/" $storage) -}} + +{{- if not $cached -}} + {{- with $remote := cond (default true $.Page.Site.Params.site.offline) false (resources.GetRemote $url) -}} + {{- with .Err -}} + {{- if not (fileExists $localFile) -}} + {{- $caption = "No local attachment data found for source" -}} + {{- warnf "Attachment local fetch error: %s" $url -}} + {{- end -}} + {{- else -}} + {{- $type = $remote.MediaType -}} + {{- $cache = $remote | resources.Copy $storage -}} + {{- $cache = $cache.Permalink -}} + {{- end -}} + {{- else -}} + {{- $caption = "Unable to load remote source data" -}} + {{- warnf "Attachment remote fetch error: %s" $url -}} + {{- end -}} +{{- else -}} + {{- with $cache = resources.Get (path.Join "public/" $storage) -}} + {{- $type = .MediaType -}} + {{- $cache = print ("" | absURL) (strings.TrimLeft "public" $cache) -}} + {{- end -}} +{{- end -}} + +{{- $data := or $cache $url -}} + +{{- if $remote -}} + {{- $data = $url -}} +{{- end -}} + +<document-attachment title="{{ $title }}"> + <object type="{{ $type }}" data="{{ $data }}"> + <p> + Your browser does not support the <code>{{ $type }}</code> plugin. Here's a + <a rel="canonical" href="{{ $data }}">link to the file</a> instead. + </p> + </object> + <footer> + {{ $caption | markdownify }} + <br /> + Index: {{ with $cache }} {{ print "[Cache](" $cache ")" | markdownify }} · {{ end }} + {{ print "[Source](" $url ")" | markdownify }} + </footer> +</document-attachment> diff --git a/themes/default/layouts/shortcodes/disclose.html b/themes/default/layouts/shortcodes/disclose.html new file mode 100644 index 0000000..231561b --- /dev/null +++ b/themes/default/layouts/shortcodes/disclose.html @@ -0,0 +1,13 @@ +{{- $text := default "Content Warning: " (.Get "text" | default (.Get 0)) -}} +{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $text)) .Ordinal -}} + +{{- if gt (len .Inner) 1 -}} + {{- $text = .Inner -}} +{{- end -}} + +<details id="disclosure-{{ $hash }}" data-disclosure=""> + <summary> + {{- (or $.Page.Params.title $text) | markdownify }} + </summary> +</details> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/footer.html b/themes/default/layouts/shortcodes/footer.html deleted file mode 100644 index 579913d..0000000 --- a/themes/default/layouts/shortcodes/footer.html +++ /dev/null @@ -1,7 +0,0 @@ -{{- $text := default "Block Quote" (.Get "text" | default (.Get 0)) -}} - -{{- if gt (len .Inner) 1 -}} - {{ $text = .Inner }} -{{- end -}} - -<span>{{ $text | markdownify }}</span> diff --git a/themes/default/layouts/shortcodes/gist.html b/themes/default/layouts/shortcodes/gist.html deleted file mode 100644 index c475672..0000000 --- a/themes/default/layouts/shortcodes/gist.html +++ /dev/null @@ -1,9 +0,0 @@ -{{- $user := default "gdb" (.Get "user" | default (.Get 0)) -}} -{{- $gist := default "b6365e79be6052e7531e7ba6ea8caf23" (.Get "gist" | default (.Get 1)) -}} -{{- $file := default "" (.Get "file" | default (.Get 2)) -}} - -<github-gist> - <script - src="https://gist.github.com/{{ $user }}/{{ $gist }}.js?file={{ $file }}"> - </script> -</github-gist> diff --git a/themes/default/layouts/shortcodes/imgur-video.html b/themes/default/layouts/shortcodes/imgur-video.html deleted file mode 100644 index a6d637a..0000000 --- a/themes/default/layouts/shortcodes/imgur-video.html +++ /dev/null @@ -1,17 +0,0 @@ -{{- $id := default "rQIb4Vw" (.Get "id" | default (.Get 0)) -}} -{{- $title := default "Imgur Gif" (.Get "title" | default (.Get 1)) -}} -{{- $caption := default "Imgur Gif" (.Get "caption" | default (.Get 2)) -}} - -{{- $options := default "controls autoplay loop muted playsinline" - (.Get "options" | default (.Get 3)) --}} - -{{- partial "video-container.html" - (dict - "Author" .Page.Section - "Caption" $caption - "Options" $options - "RelURL" (strings.TrimPrefix .Site.BaseURL .Page.Permalink) - "Source" (print "https://i.imgur.com/" $id ".mp4") - ) --}} diff --git a/themes/default/layouts/shortcodes/imgur.html b/themes/default/layouts/shortcodes/imgur.html deleted file mode 100644 index f51bcef..0000000 --- a/themes/default/layouts/shortcodes/imgur.html +++ /dev/null @@ -1,13 +0,0 @@ -{{- $id := default "mkVcxUi" (.Get "id" | default (.Get 0)) -}} - -<imgur-image> - <blockquote - class="imgur-embed-pub" - lang="en" - data-id="a/{{ $id }}" - data-context="false" - > - <a href="//imgur.com/a/{{ $id }}"></a> - </blockquote> - <script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script> -</imgur-image> diff --git a/themes/default/layouts/shortcodes/kbd.html b/themes/default/layouts/shortcodes/kbd.html index b24fd9d..63af975 100644 --- a/themes/default/layouts/shortcodes/kbd.html +++ b/themes/default/layouts/shortcodes/kbd.html @@ -1,3 +1,4 @@ {{- $key := default "Ctrl" (.Get "key" | default (.Get 0)) -}} <kbd title="{{ $key }}">{{ $key | markdownify }}</kbd> +{{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/link.html b/themes/default/layouts/shortcodes/link.html new file mode 100644 index 0000000..49cd1c4 --- /dev/null +++ b/themes/default/layouts/shortcodes/link.html @@ -0,0 +1,36 @@ +{{- $source := default "https://example.com/" (.Get "source" | default (.Get 0)) -}} + +{{- $host := $source -}} + +{{- with (urls.Parse $source).Host -}} + {{- $host = . -}} +{{- end -}} + +{{- $favicon := partial "function-favicon-domain.html" $host -}} + +{{- $image := partial "function-fetch-favicons.html" + (dict + "Context" .Page + "Source" $favicon + "Infix" ($host | anchorize) + ) +-}} + +<link-card> + <a href="{{ $source }}"> + <img + loading="lazy" + alt="{{ $host }}" + title="{{ $host }}" + height="{{ $image.Height }}" + width="{{ $image.Width }}" + src="{{ $image.Permalink }}" + /> + </a> + <article> + <h2>{{ $host }}</h2> + <a href="{{ $source }}"> + {{ $source }} + </a> + </article> +</link-card> diff --git a/themes/default/layouts/shortcodes/mark.html b/themes/default/layouts/shortcodes/mark.html index 02af225..1b9ef3d 100644 --- a/themes/default/layouts/shortcodes/mark.html +++ b/themes/default/layouts/shortcodes/mark.html @@ -1,5 +1,15 @@ -{{- $text := default "highligted text" (.Get "text" | default (.Get 0)) -}} -{{- $title := default $text (.Get "title" | default (.Get 1)) -}} +{{- $text := default "mark" (.Get "text" | default (.Get 0)) -}} +{{- $title := default "highlighted text" (.Get "title" | default (.Get 1)) -}} +{{- $id := default "" (.Get "id" | default (.Get 2)) -}} -<mark title="{{ $title }}">{{ $text }}</mark> +{{- if gt (len .Inner) 1 -}} + {{- $text = trim .Inner "\n" -}} +{{- end -}} + +{{- if $id -}} + {{- $id = print "mark:" (truncate 30 "" $text | anchorize | replaceRE `\d` "") -}} + {{- $id = printf `id=%q` $id -}} +{{- end -}} + +<mark {{ $id | safeHTMLAttr }} title="{{- $title -}}"><span>{{- $text | markdownify -}}</span></mark> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/markdown.html b/themes/default/layouts/shortcodes/markdown.html index 3bc8726..f73aa90 100644 --- a/themes/default/layouts/shortcodes/markdown.html +++ b/themes/default/layouts/shortcodes/markdown.html @@ -1,4 +1,4 @@ -{{- $link := default (print "/" (partial "function-paths-markdown.html") "/" .Page.File ) (.Get "link" | default (.Get 0)) -}} +{{- $link := default (print "/" (partial "function-paths.html").markdown "/" .Page.File ) (.Get "link" | default (.Get 0)) -}} {{- $text := default (path.Base .Page.File) (.Get "text" | default (.Get 1)) -}} {{- $title := default "" (.Get "title" | default (.Get 2)) -}} {{- $embed := default false (.Get "embed" | default (.Get 3)) -}} diff --git a/themes/default/layouts/shortcodes/odysee.html b/themes/default/layouts/shortcodes/odysee.html index 0f2899e..cca7e9c 100644 --- a/themes/default/layouts/shortcodes/odysee.html +++ b/themes/default/layouts/shortcodes/odysee.html @@ -8,7 +8,8 @@ id="odysee-iframe" src="{{ $url }}" title="{{ $title }}" - allowfullscreen> + allowfullscreen="" + > </iframe> <footer>{{ $caption | markdownify }}</footer> </odysee-video> diff --git a/themes/default/layouts/shortcodes/pdf.html b/themes/default/layouts/shortcodes/pdf.html deleted file mode 100644 index 824169b..0000000 --- a/themes/default/layouts/shortcodes/pdf.html +++ /dev/null @@ -1,11 +0,0 @@ -{{- $url := default "https://www.gutenberg.org/files/98/old/2city12p.pdf" (.Get "url" | default (.Get 0)) -}} -{{- $title := default "PDF Document" (.Get "title" | default (.Get 1)) -}} -{{- $caption := default (print $title " ([Download](" $url "))") (.Get "caption" | default (.Get 2)) -}} - -<pdf-container title="{{ $title }}"> - <iframe loading="lazy" - sandbox="allow-scripts allow-presentation allow-same-origin" - src="https://docs.google.com/gview?url={{ $url }}&embedded=true"> - </iframe> - <footer>{{ $caption | markdownify }}</footer> -</pdf-container> diff --git a/themes/default/layouts/shortcodes/quote.html b/themes/default/layouts/shortcodes/quote.html index b933286..e0048d9 100644 --- a/themes/default/layouts/shortcodes/quote.html +++ b/themes/default/layouts/shortcodes/quote.html @@ -3,11 +3,9 @@ <q cite="$cite" title="{{ $text | markdownify }}"> {{- if $cite -}} - <a rel="noopener" href="{{ $cite }}" target="_blank"> - {{- end -}} - {{ $text | markdownify }} - {{- if $cite -}} - </a> + {{- print "[" $text "](" $cite ")" | markdownify -}} + {{- else -}} + {{- $text | markdownify -}} {{- end -}} </q> {{- /* This comment removes trailing newlines and white spaces. */ -}} diff --git a/themes/default/layouts/shortcodes/react.html b/themes/default/layouts/shortcodes/react.html new file mode 100644 index 0000000..ea96101 --- /dev/null +++ b/themes/default/layouts/shortcodes/react.html @@ -0,0 +1,30 @@ +{{- $text := default "react" (.Get "text" | default (.Get 0)) -}} +{{- $source := default "" (.Get "source" | default (.Get 1)) -}} +{{- $title := default $text (.Get "title" | default (.Get 2)) -}} +{{- $alternate := default $title (.Get "alternate" | default (.Get 3)) -}} + +{{- $author := .Page.Section -}} + +{{- $image := partial "function-caches-images.html" + (dict + "Context" .Page + "Source" $source + "Fit" "100x100" + "Target" (print (partial "function-paths.html").media "/" $author "/") + "Copy" (print (partial "function-paths.html").media "/" $author "/react-" (path.Base $source)) + "AlternateCopy" (print (partial "function-paths.html").media "/" $author "/react-" (path.BaseName $source) ".webp") + ) +-}} + +<tool-tip data-type="reaction" title="{{ $title }}"> + {{ $text | markdownify }} + <a href="{{ $image.Permalink }}"> + <img + width="{{ $image.Width }}" + height="{{ $image.Height }}" + title="{{ $title }}" + alt="{{ $alternate }}" + src="{{ $image.Permalink }}" + /> + </a> +</tool-tip> diff --git a/themes/default/layouts/shortcodes/react.rss.xml b/themes/default/layouts/shortcodes/react.rss.xml new file mode 100644 index 0000000..0e03675 --- /dev/null +++ b/themes/default/layouts/shortcodes/react.rss.xml @@ -0,0 +1,19 @@ +{{- $text := default "react" (.Get "text" | default (.Get 0)) -}} +{{- $source := default "" (.Get "source" | default (.Get 1)) -}} +{{- $title := default $text (.Get "title" | default (.Get 2)) -}} +{{- $alternate := default $title (.Get "alternate" | default (.Get 3)) -}} + +{{- $author := .Page.Section -}} + +{{- $image := partial "function-caches-images.html" + (dict + "Context" .Page + "Source" $source + "Fit" "100x100" + "Target" (print (partial "function-paths.html").media "/" $author "/") + "Copy" (print (partial "function-paths.html").media "/" $author "/react-" (path.Base $source)) + "AlternateCopy" (print (partial "function-paths.html").media "/" $author "/react-" (path.BaseName $source) ".webp") + ) +-}} + +{{ $text | markdownify }} (<a title="{{ $title }}" href="{{ $image.Permalink }}">reaction</a>) diff --git a/themes/default/layouts/shortcodes/reddit.html b/themes/default/layouts/shortcodes/reddit.html deleted file mode 100644 index 10ef0b9..0000000 --- a/themes/default/layouts/shortcodes/reddit.html +++ /dev/null @@ -1,29 +0,0 @@ -{{- $path := default "linux/comments/aeufh6/vlc_has_now_reached_3_billions_downloads_and/edsvibz" (.Get "path" | default (.Get 0)) -}} -{{- $depth := default "2" (.Get "depth" | default (.Get 1)) -}} -{{- $context := default "1" (.Get "context" | default (.Get 2)) -}} -{{- $theme := default "light" (.Get "theme" | default (.Get 3)) -}} -{{- $showtitle := default "true" (.Get "showtitle" | default (.Get 4)) -}} -{{- $showedits := default "false" (.Get "showedits" | default (.Get 5)) -}} -{{- $showmedia := default "false" (.Get "showmedia" | default (.Get 6)) -}} -{{- $showmore := default "false" (.Get "showmore" | default (.Get 7)) -}} - -<reddit-comment> - <iframe loading="lazy" - id="reddit-embed" - src="https://www.redditmedia.com/r/{{ trim $path "/" }}/ -?depth={{ $depth }} -&embed=true -&showmore={{ $showmore }} -&showtitle={{ $showtitle }} -&context={{ $context }} -&showmedia={{ $showmedia }} -&theme={{ $theme }} -&showedits={{ $showedits }} -&created={{ now.Format "2006-01-02T15:04:05Z" }}" - sandbox="allow-scripts allow-same-origin allow-popups" - style="border: none;" - height="452" - width="640" - scrolling="no" - ></iframe> -</reddit-comment> diff --git a/themes/default/layouts/shortcodes/self.html b/themes/default/layouts/shortcodes/self.html index 2f0d7eb..6036e07 100644 --- a/themes/default/layouts/shortcodes/self.html +++ b/themes/default/layouts/shortcodes/self.html @@ -10,6 +10,7 @@ <self-embed> <iframe height="165" + scrolling="no" sandbox="{{ $sandbox }}" src="{{ .Site.BaseURL }}{{ $url }}" title="{{ $title }}" diff --git a/themes/default/layouts/shortcodes/spoiler.html b/themes/default/layouts/shortcodes/spoiler.html index 9267876..9c5e59a 100644 --- a/themes/default/layouts/shortcodes/spoiler.html +++ b/themes/default/layouts/shortcodes/spoiler.html @@ -1,9 +1,13 @@ {{- $text := default "This is a spoiler." (.Get "text" | default (.Get 0)) -}} {{- $title := default "Click to show/hide text." (.Get "title" | default (.Get 1)) -}} +{{- $hash := print (truncate 4 "" (sha256 .Page.RelPermalink)) (truncate 4 "" (sha256 $text)) .Ordinal -}} -{{ if gt (len .Inner) 1 }} - {{ $text = .Inner }} -{{ end }} +{{- if gt (len .Inner) 1 -}} + {{- $text = .Inner -}} +{{- end -}} -<input hidden type="checkbox" id="spoiler-text-{{ md5 $text }}" /> -<s title="{{ $title }}"><label for="spoiler-text-{{ md5 $text }}">{{ $text | markdownify }}</label></s> +<input hidden="" type="checkbox" id="spoiler-text-{{ $hash }}" /> + +<s title="{{ $title }}"> + <label for="spoiler-text-{{ $hash }}">{{ $text | markdownify }}</label> +</s> diff --git a/themes/default/layouts/shortcodes/spoiler.rss.xml b/themes/default/layouts/shortcodes/spoiler.rss.xml index 73dde8a..adbce7b 100644 --- a/themes/default/layouts/shortcodes/spoiler.rss.xml +++ b/themes/default/layouts/shortcodes/spoiler.rss.xml @@ -5,4 +5,6 @@ {{ $text = .Inner }} {{ end }} -<s title="{{ $title }}"><label for="spoiler-text-{{ md5 $text }}">{{ $text | markdownify }}</label></s> +<s title="{{ $title }}"> + <label>{{ $text | markdownify }}</label> +</s> diff --git a/themes/default/layouts/shortcodes/tweet.html b/themes/default/layouts/shortcodes/tweet.html deleted file mode 100644 index faf1f00..0000000 --- a/themes/default/layouts/shortcodes/tweet.html +++ /dev/null @@ -1,18 +0,0 @@ -{{- $user := default "jack" (.Get "user" | default (.Get 0)) -}} -{{- $status := default "20" (.Get "status" | default (.Get 1)) -}} -{{- $caption := default "Twitter Tweet" (.Get "caption" | default (.Get 2)) -}} - -<twitter-tweet> - <blockquote class="twitter-tweet"> - <a href="https://twitter.com/{{ $user }}/status/{{ $status }}"> - https://twitter.com/{{ $user }}/status/{{ $status }} - </a> - </blockquote> - <script - async - src="https://platform.twitter.com/widgets.js" - charset="utf-8"> - </script> -</twitter-tweet> - -<footer>{{ $caption }}</footer> diff --git a/themes/default/layouts/shortcodes/version.html b/themes/default/layouts/shortcodes/version.html new file mode 100644 index 0000000..2e3eda8 --- /dev/null +++ b/themes/default/layouts/shortcodes/version.html @@ -0,0 +1,20 @@ +{{- $version := "0.11.12" -}} +{{- $generator := "0.110.0" -}} + +{{- $number := default false (.Get "number" | default (.Get 0)) -}} +{{- $clone := default false (.Get "clone" | default (.Get 1)) -}} +{{- $hugo := default false (.Get "hugo" | default (.Get 2)) -}} + +{{- if $number -}} + {{ $version }} +{{- end -}} + +{{- if $hugo -}} + {{ $generator }} +{{- end -}} + +{{- if $clone -}} +```shell +git clone --branch {{ $version }} https://www.thedroneely.com/git/thedroneely/canory +``` +{{- end -}} diff --git a/themes/default/layouts/shortcodes/asciicast.html b/themes/default/layouts/shortcodes/video-ascii.html index 10da091..10da091 100644 --- a/themes/default/layouts/shortcodes/asciicast.html +++ b/themes/default/layouts/shortcodes/video-ascii.html diff --git a/themes/default/layouts/shortcodes/video-imgur.html b/themes/default/layouts/shortcodes/video-imgur.html new file mode 100644 index 0000000..2edb9a4 --- /dev/null +++ b/themes/default/layouts/shortcodes/video-imgur.html @@ -0,0 +1,14 @@ +{{- $id := default "rQIb4Vw" (.Get "id" | default (.Get 0)) -}} +{{- $title := default "Imgur Gif" (.Get "title" | default (.Get 1)) -}} +{{- $caption := default $title (.Get "caption" | default (.Get 2)) -}} + +{{- $options := default "controls autoplay loop muted playsinline" + (.Get "options" | default (.Get 3)) +-}} + +{{- $source := print "https://i.imgur.com/" $id ".mp4" -}} + +{{- printf `{{< video source="%s" title="%s" caption="%s" options="%s" >}}` + $source $title $caption $options + | .Page.RenderString +-}} diff --git a/themes/default/layouts/shortcodes/video.html b/themes/default/layouts/shortcodes/video.html index bb49f8c..289559c 100644 --- a/themes/default/layouts/shortcodes/video.html +++ b/themes/default/layouts/shortcodes/video.html @@ -1,32 +1,36 @@ {{- - $source := default + $source := default "https://raw.githubusercontent.com/benhosmer/HTML5-Test-Videos/9a6c2db46472454c634963cbeb0900fd37901fac/big_buck_bunny.mp4" (.Get "source" | default (.Get 0)) -}} -{{- $poster := default "" (.Get "poster" | default (.Get 1)) -}} -{{- $width := default "" (.Get "width" | default (.Get 2)) -}} -{{- $height := default "" (.Get "height" | default (.Get 3)) -}} -{{- $preload := default "metadata" (.Get "preload" | default (.Get 4)) -}} -{{- $options := default "controls" (.Get "options" | default (.Get 5)) -}} -{{- $caption := default "`HTML5` Video" (.Get "caption" | default (.Get 6)) -}} -{{- $title := default "HTML5 Video" (.Get "title" | default (.Get 7)) -}} -{{- $start := default "" (.Get "start" | default (.Get 8)) -}} -{{- $end := default "" (.Get "end" | default (.Get 9)) -}} +{{- $poster := default "" (.Get "poster" | default (.Get 1)) -}} +{{- $width := default "" (.Get "width" | default (.Get 2)) -}} +{{- $height := default "" (.Get "height" | default (.Get 3)) -}} +{{- $preload := default "metadata" (.Get "preload" | default (.Get 4)) -}} +{{- $options := default "controls" (.Get "options" | default (.Get 5)) -}} +{{- $caption := default "Untitled Video" (.Get "caption" | default (.Get 6)) -}} +{{- $title := default $caption (.Get "title" | default (.Get 7)) -}} +{{- $start := default "" (.Get "start" | default (.Get 8)) -}} +{{- $end := default "" (.Get "end" | default (.Get 9)) -}} +{{- $orientation := default "landscape" (.Get "orientation" | default (.Get 10)) -}} +{{- $remote := default "" (.Get "remote" | default (.Get 11)) -}} {{- partial "video-container.html" (dict - "Author" .Page.Section - "Caption" $caption - "End" $end - "Height" $height - "Options" $options - "Poster" $poster - "Preload" $preload - "RelURL" (strings.TrimPrefix .Site.BaseURL .Page.Permalink) - "Source" $source - "Source" $source - "Start" $start - "Title" $title - "Width" $width + "Author" .Page.Section + "Caption" $caption + "Context" .Page + "End" $end + "Height" $height + "Options" $options + "Orientation" $orientation + "Poster" $poster + "Preload" $preload + "RelURL" (strings.TrimPrefix .Site.BaseURL .Page.Permalink) + "Remote" $remote + "Source" $source + "Start" $start + "Title" $title + "Width" $width ) -}} diff --git a/themes/default/layouts/shortcodes/video.rss.xml b/themes/default/layouts/shortcodes/video.rss.xml new file mode 100644 index 0000000..be262e7 --- /dev/null +++ b/themes/default/layouts/shortcodes/video.rss.xml @@ -0,0 +1,29 @@ +{{- + $source := default + "https://raw.githubusercontent.com/benhosmer/HTML5-Test-Videos/9a6c2db46472454c634963cbeb0900fd37901fac/big_buck_bunny.mp4" + (.Get "source" | default (.Get 0)) +-}} +{{- $poster := default "" (.Get "poster" | default (.Get 1)) -}} +{{- $width := default "" (.Get "width" | default (.Get 2)) -}} +{{- $height := default "" (.Get "height" | default (.Get 3)) -}} +{{- $preload := default "metadata" (.Get "preload" | default (.Get 4)) -}} +{{- $options := default "controls" (.Get "options" | default (.Get 5)) -}} +{{- $caption := default "Untitled Video" (.Get "caption" | default (.Get 6)) -}} +{{- $title := default $caption (.Get "title" | default (.Get 7)) -}} +{{- $start := default "" (.Get "start" | default (.Get 8)) -}} +{{- $end := default "" (.Get "end" | default (.Get 9)) -}} +{{- $orientation := default "landscape" (.Get "orientation" | default (.Get 10)) -}} +{{- $remote := default "" (.Get "remote" | default (.Get 11)) -}} + +<p> + <b> + <a + title="{{ $title }}" + href="{{ $source }}" + > + Video: {{ $caption -}} + </a> + </b> + <br> + <span>Title: {{ $title }}</span> +</p> diff --git a/themes/default/layouts/shortcodes/vimeo.html b/themes/default/layouts/shortcodes/vimeo.html deleted file mode 100644 index 009ebb0..0000000 --- a/themes/default/layouts/shortcodes/vimeo.html +++ /dev/null @@ -1,12 +0,0 @@ -{{- $id := default "1084537" (.Get "id" | default (.Get 0)) -}} -{{- $title := default "Vimeo Video" (.Get "title" | default (.Get 1)) -}} - -<vimeo-video> - <div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"> - <iframe loading="lazy" - src="https://player.vimeo.com/video/{{ $id }}?dnt=1" - style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" - title="{{ $title }}" webkitallowfullscreen mozallowfullscreen allowfullscreen> - </iframe> - </div> -</vimeo-video> diff --git a/themes/default/layouts/shortcodes/wikipedia.html b/themes/default/layouts/shortcodes/wikipedia.html index 65fa399..dd33a55 100644 --- a/themes/default/layouts/shortcodes/wikipedia.html +++ b/themes/default/layouts/shortcodes/wikipedia.html @@ -7,7 +7,9 @@ -}} <wikipedia-container title="{{ $title }}"> - <iframe loading="lazy" + <iframe + loading="lazy" + scrolling="no" height="300" src="https://en.m.wikipedia.org/wiki/{{ $id }}" title="{{ $title }}" diff --git a/themes/default/layouts/shortcodes/youtube.html b/themes/default/layouts/shortcodes/youtube.html index 99612ed..9ec1cfb 100644 --- a/themes/default/layouts/shortcodes/youtube.html +++ b/themes/default/layouts/shortcodes/youtube.html @@ -1,10 +1,12 @@ -{{- $url := "www.youtube-nocookie.com" -}} {{- $id := default "aqz-KE-bpKQ" (.Get "id" | default (.Get 0)) -}} {{- $title := default "YouTube Video" (.Get "title" | default (.Get 1)) -}} {{- $start := default "" (.Get "start" | default (.Get 2)) -}} {{- $end := default "" (.Get "end" | default (.Get 3)) -}} {{- $muted := default "" (.Get "muted" | default (.Get 4)) -}} +{{- $url := "www.youtube-nocookie.com" -}} +{{- $controls := "?controls=1" -}} + {{- if (and $start $end) -}} {{ $start = print "&start=" $start }} {{ $end = print "&end=" $end }} @@ -15,11 +17,14 @@ {{- end -}} <youtube-video> - <iframe loading="lazy" + <iframe + allowfullscreen="" height="300" + loading="lazy" + title="{{ $title }}" sandbox="allow-scripts allow-same-origin" - src="https://{{ $url }}/embed/{{ $id }}{{ "?controls=1" }}{{ $start }}{{ $end }}{{ $muted }}" - allowfullscreen title="{{ $title }}"> + src="https://{{ $url }}/embed/{{ $id }}{{ $controls }}{{ $start }}{{ $end }}{{ $muted }}" + > </iframe> <footer> {{ $title | markdownify }} |