From 6c889c658ed71bdc18e5b767053530618dcf1759 Mon Sep 17 00:00:00 2001 From: tdro Date: Sun, 22 Jan 2023 02:42:39 -0500 Subject: themes/default/layouts: Tighten up the markup Might be able to get free computation.. --- .../layouts/_default/_markup/render-codeblock.html | 4 ++-- .../layouts/_default/_markup/render-image.html | 2 +- .../default/layouts/_default/_markup/render-link.html | 2 +- themes/default/layouts/_default/baseof.html | 3 ++- themes/default/layouts/_default/single.html | 16 ++++++++-------- themes/default/layouts/partials/base-canonical.html | 2 +- themes/default/layouts/partials/video-container.html | 19 +++++++++++-------- themes/default/layouts/shortcodes/abbr.html | 2 +- themes/default/layouts/shortcodes/animate.html | 2 +- themes/default/layouts/shortcodes/odysee.html | 3 ++- themes/default/layouts/shortcodes/spoiler.html | 2 +- themes/default/layouts/shortcodes/youtube.html | 13 +++++++++---- 12 files changed, 40 insertions(+), 30 deletions(-) diff --git a/themes/default/layouts/_default/_markup/render-codeblock.html b/themes/default/layouts/_default/_markup/render-codeblock.html index d629a85..85e60b2 100644 --- a/themes/default/layouts/_default/_markup/render-codeblock.html +++ b/themes/default/layouts/_default/_markup/render-codeblock.html @@ -4,12 +4,12 @@ {{- $hash := print (truncate 8 "" (sha256 .Inner)) .Ordinal -}} {{- $id := print "code-block-" $hash -}} - +
{{ $type }} - diff --git a/themes/default/layouts/_default/_markup/render-image.html b/themes/default/layouts/_default/_markup/render-image.html index 3767cb8..8f337ad 100644 --- a/themes/default/layouts/_default/_markup/render-image.html +++ b/themes/default/layouts/_default/_markup/render-image.html @@ -108,7 +108,7 @@
{{ $figcaption }} -
+
Index: {{ with $cache }} {{ print "[Cache](" $cache ")" | markdownify }} · {{ end }} {{ print "[Source](" $source ")" | markdownify }}
diff --git a/themes/default/layouts/_default/_markup/render-link.html b/themes/default/layouts/_default/_markup/render-link.html index 00a6fd5..ccfbc06 100644 --- a/themes/default/layouts/_default/_markup/render-link.html +++ b/themes/default/layouts/_default/_markup/render-link.html @@ -22,7 +22,7 @@ {{- if $remote }} rel="noopener no-referrer" {{- else }} - data-internal + data-internal="" {{- end }} href="{{ $link | safeURL }}" {{ with or .Title ($link | safeURL) -}} diff --git a/themes/default/layouts/_default/baseof.html b/themes/default/layouts/_default/baseof.html index 82d5acf..d42a954 100644 --- a/themes/default/layouts/_default/baseof.html +++ b/themes/default/layouts/_default/baseof.html @@ -3,7 +3,8 @@ lang="en-us" data-kind="{{ .Page.Kind }}" data-type="{{ .Page.Type }}" - itemscope itemtype="http://schema.org/BlogPosting" + itemscope="" + itemtype="http://schema.org/BlogPosting" > diff --git a/themes/default/layouts/_default/single.html b/themes/default/layouts/_default/single.html index d94f514..bf077f9 100644 --- a/themes/default/layouts/_default/single.html +++ b/themes/default/layouts/_default/single.html @@ -1,12 +1,12 @@ -{{ define "styles" }} +{{- define "styles" -}} <style> {{ partial "styles-navigator.html" (dict "Link" "/") | safeCSS }} </style> -{{ end }} +{{- end -}} -{{ define "middle" }} +{{- define "middle" -}} -{{ partial "navigator-middle.html" +{{- partial "navigator-middle.html" (dict "Title" "Message" "Subtitle" "Thread" @@ -16,7 +16,7 @@ "Id" "back" "Context" . ) -}} +-}} <micro-thread> {{ .Render "summary" }} @@ -45,8 +45,8 @@ {{- end -}} </micro-thread> -{{ end }} +{{- end -}} -{{ define "right" }} +{{- define "right" -}} {{- partial "navigator-right.html" . -}} -{{ end }} +{{- end -}} diff --git a/themes/default/layouts/partials/base-canonical.html b/themes/default/layouts/partials/base-canonical.html index 804c8ce..051e450 100644 --- a/themes/default/layouts/partials/base-canonical.html +++ b/themes/default/layouts/partials/base-canonical.html @@ -12,4 +12,4 @@ {{- $canonical = $.Params.canonical -}} {{- end -}} - <link rel="canonical" href="{{ $canonical }}" /> +<link rel="canonical" href="{{ $canonical }}" /> diff --git a/themes/default/layouts/partials/video-container.html b/themes/default/layouts/partials/video-container.html index bae0cbb..7d934e6 100644 --- a/themes/default/layouts/partials/video-container.html +++ b/themes/default/layouts/partials/video-container.html @@ -56,17 +56,20 @@ {{ with .Poster }} poster="{{ . }}" {{ end -}} {{ with .Width }} width="{{ . }}" {{ end -}} {{ with .Height }} height="{{ . }}" {{ end -}} - {{ .Options | safeHTMLAttr }}> - <source src="{{ $source }}{{ $timestamp }}"> - {{ print "Video: " $caption "." | markdownify }} - <p> - Sorry, your browser does not support embedded videos. Here is a - <a href="{{ .Source }}">link to the video</a> instead. - </p> + {{- range $value := (split .Options " ") }} + {{- printf `%s=""` $value | safeHTMLAttr }} + {{ end -}} + > + <source src="{{ $source }}{{ $timestamp }}" /> + {{ print "Video: " $caption "." | markdownify }} + <p> + Sorry, your browser does not support embedded videos. Here is a + <a href="{{ .Source }}">link to the video</a> instead. + </p> </video> <footer> {{ $caption | markdownify }} - <br> + <br /> Index: {{ with $cache }} {{ print "[Cache](" . ")" | markdownify }} · {{ end }} {{ print "[Source](" .Source ")" | markdownify }} </footer> diff --git a/themes/default/layouts/shortcodes/abbr.html b/themes/default/layouts/shortcodes/abbr.html index bad8895..2a87233 100644 --- a/themes/default/layouts/shortcodes/abbr.html +++ b/themes/default/layouts/shortcodes/abbr.html @@ -2,7 +2,7 @@ {{- $title := default "Too long, didn't read" (.Get "title" | default (.Get 1)) -}} {{- $hash := print (truncate 8 "" (sha256 $abbr)) .Ordinal -}} -<input hidden type="checkbox" id="abbr-{{ $hash }}" /> +<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 index 5d72671..b245596 100644 --- a/themes/default/layouts/shortcodes/animate.html +++ b/themes/default/layouts/shortcodes/animate.html @@ -3,7 +3,7 @@ {{- $letters := split $text "" -}} -<text-animation {{ $type }}> +<text-animation {{ $type }}=""> {{- range $value, $letter := $letters -}} <span style="--frame:{{ $value }}">{{ $letter }}</span> {{- end -}} 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/spoiler.html b/themes/default/layouts/shortcodes/spoiler.html index ebc3643..5a9462d 100644 --- a/themes/default/layouts/shortcodes/spoiler.html +++ b/themes/default/layouts/shortcodes/spoiler.html @@ -6,7 +6,7 @@ {{- $text = .Inner -}} {{- end -}} -<input hidden type="checkbox" id="spoiler-text-{{ $hash }}" /> +<input hidden="" type="checkbox" id="spoiler-text-{{ $hash }}" /> <s title="{{ $title }}"> <label for="spoiler-text-{{ $hash }}">{{ $text | markdownify }}</label> 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 }} -- cgit v1.2.3