mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-30 22:39:58 +02:00
Reimplement and simplify Hugo's template system
See #13541 for details. Fixes #13545 Fixes #13515 Closes #7964 Closes #13365 Closes #12988 Closes #4891
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
{{ define "__h_simple_css" }}{{/* These template definitions are global. */}}
|
||||
{{- if not (.Page.Scratch.Get "__h_simple_css") -}}
|
||||
{{/* Only include once */}}
|
||||
{{- .Page.Scratch.Set "__h_simple_css" true -}}
|
||||
<style>
|
||||
.__h_video {
|
||||
position: relative;
|
||||
padding-bottom: 56.23%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
background: #000;
|
||||
}
|
||||
.__h_video img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
color: #000;
|
||||
}
|
||||
.__h_video .play {
|
||||
height: 72px;
|
||||
width: 72px;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
margin-left: -36px;
|
||||
margin-top: -36px;
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- define "__h_simple_icon_play" -}}
|
||||
<svg version="1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 61 61"><circle cx="30.5" cy="30.5" r="30.5" opacity=".8" fill="#000"></circle><path d="M25.3 19.2c-2.1-1.2-3.8-.2-3.8 2.2v18.1c0 2.4 1.7 3.4 3.8 2.2l16.6-9.1c2.1-1.2 2.1-3.2 0-4.4l-16.6-9z" fill="#fff"></path></svg>
|
||||
{{- end -}}
|
2
tpl/tplimpl/embedded/templates/_shortcodes/comment.html
Normal file
2
tpl/tplimpl/embedded/templates/_shortcodes/comment.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{{- warnf "The %q shortcode was deprecated in v0.143.0 and will be removed in a future release. Please use HTML comments instead. See %s" .Name .Position -}}
|
||||
{{- $noop := .Inner -}}
|
75
tpl/tplimpl/embedded/templates/_shortcodes/details.html
Normal file
75
tpl/tplimpl/embedded/templates/_shortcodes/details.html
Normal file
@@ -0,0 +1,75 @@
|
||||
{{- /*
|
||||
Renders an HTML details element.
|
||||
|
||||
@param {string} [class] The value of the element's class attribute.
|
||||
@param {string} [name] The value of the element's name attribute.
|
||||
@param {string} [summary] The content of the child summary element.
|
||||
@param {string} [title] The value of the element's title attribute.
|
||||
@param {bool} [open=false] Whether to initially display the content of the details element.
|
||||
|
||||
@reference https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
|
||||
|
||||
@examples
|
||||
|
||||
{{< details >}}
|
||||
A basic collapsible section.
|
||||
{{< /details >}}
|
||||
|
||||
{{< details summary="Custom Summary Text" >}}
|
||||
Showing custom `summary` text.
|
||||
{{< /details >}}
|
||||
|
||||
{{< details summary="Open Details" open=true >}}
|
||||
Contents displayed initially by using `open`.
|
||||
{{< /details >}}
|
||||
|
||||
{{< details summary="Styled Content" class="my-custom-class" >}}
|
||||
Content can be styled with CSS by specifying a `class`.
|
||||
|
||||
Target details element:
|
||||
|
||||
```css
|
||||
details.my-custom-class { }
|
||||
```
|
||||
|
||||
Target summary element:
|
||||
|
||||
```css
|
||||
details.my-custom-class > summary > * { }
|
||||
```
|
||||
|
||||
Target inner content:
|
||||
|
||||
```css
|
||||
details.my-custom-class > :not(summary) { }
|
||||
```
|
||||
{{< /details >}}
|
||||
|
||||
{{< details summary="Grouped Details" name="my-details" >}}
|
||||
Specifying a `name` allows elements to be connected, with only one able to be open at a time.
|
||||
{{< /details >}}
|
||||
|
||||
*/}}
|
||||
|
||||
{{- /* Get arguments. */}}
|
||||
{{- $class := or (.Get "class") "" }}
|
||||
{{- $name := or (.Get "name") "" }}
|
||||
{{- $summary := or (.Get "summary") "Details" }}
|
||||
{{- $title := or (.Get "title") "" }}
|
||||
{{- $open := false }}
|
||||
{{- if in (slice "false" false 0) (.Get "open") }}
|
||||
{{- $open = false }}
|
||||
{{- else if in (slice "true" true 1) (.Get "open") }}
|
||||
{{- $open = true }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Render. */}}
|
||||
<details
|
||||
{{- with $class }} class="{{ . }}" {{- end }}
|
||||
{{- with $name }} name="{{ . }}" {{- end }}
|
||||
{{- with $open }} open {{- end }}
|
||||
{{- with $title }} title="{{ . }}" {{- end -}}
|
||||
>
|
||||
<summary>{{ $summary | .Page.RenderString }}</summary>
|
||||
{{ .Inner | .Page.RenderString (dict "display" "block") -}}
|
||||
</details>
|
38
tpl/tplimpl/embedded/templates/_shortcodes/figure.html
Normal file
38
tpl/tplimpl/embedded/templates/_shortcodes/figure.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
|
||||
{{- if .Get "link" -}}
|
||||
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||
{{- end -}}
|
||||
|
||||
{{- $u := urls.Parse (.Get "src") -}}
|
||||
{{- $src := $u.String -}}
|
||||
{{- if not $u.IsAbs -}}
|
||||
{{- with or (.Page.Resources.Get $u.Path) (resources.Get $u.Path) -}}
|
||||
{{- $src = .RelPermalink -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<img src="{{ $src }}"
|
||||
{{- if or (.Get "alt") (.Get "caption") }}
|
||||
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
|
||||
{{- end -}}
|
||||
{{- with .Get "width" }} width="{{ . }}"{{ end -}}
|
||||
{{- with .Get "height" }} height="{{ . }}"{{ end -}}
|
||||
{{- with .Get "loading" }} loading="{{ . }}"{{ end -}}
|
||||
><!-- Closing img tag -->
|
||||
{{- if .Get "link" }}</a>{{ end -}}
|
||||
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
|
||||
<figcaption>
|
||||
{{ with (.Get "title") -}}
|
||||
<h4>{{ . }}</h4>
|
||||
{{- end -}}
|
||||
{{- if or (.Get "caption") (.Get "attr") -}}<p>
|
||||
{{- .Get "caption" | markdownify -}}
|
||||
{{- with .Get "attrlink" }}
|
||||
<a href="{{ . }}">
|
||||
{{- end -}}
|
||||
{{- .Get "attr" | markdownify -}}
|
||||
{{- if .Get "attrlink" }}</a>{{ end }}</p>
|
||||
{{- end }}
|
||||
</figcaption>
|
||||
{{- end }}
|
||||
</figure>
|
2
tpl/tplimpl/embedded/templates/_shortcodes/gist.html
Normal file
2
tpl/tplimpl/embedded/templates/_shortcodes/gist.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{{- warnf "The %q shortcode was deprecated in v0.143.0 and will be removed in a future release. See https://gohugo.io/shortcodes/gist for instructions to create a replacement." .Name -}}
|
||||
<script src="https://gist.github.com/{{ index .Params 0 }}/{{ index .Params 1 }}.js{{if len .Params | eq 3 }}?file={{ index .Params 2 }}{{end}}"></script>
|
@@ -0,0 +1 @@
|
||||
{{ if len .Params | eq 2 }}{{ highlight (trim .InnerDeindent "\n\r") (.Get 0) (.Get 1) }}{{ else }}{{ highlight (trim .InnerDeindent "\n\r") (.Get 0) "" }}{{ end }}
|
244
tpl/tplimpl/embedded/templates/_shortcodes/instagram.html
Normal file
244
tpl/tplimpl/embedded/templates/_shortcodes/instagram.html
Normal file
@@ -0,0 +1,244 @@
|
||||
{{- $pc := site.Config.Privacy.Instagram -}}
|
||||
{{- if not $pc.Disable -}}
|
||||
{{- with .Get 0 -}}
|
||||
{{- template "render-instagram" (dict "id" . "pc" $pc) -}}
|
||||
{{- else -}}
|
||||
{{- errorf "The %q shortocde requires a single positional parameter, the ID of the Instagram post. See %s" .Name .Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "render-instagram" -}}
|
||||
<blockquote
|
||||
class="instagram-media"
|
||||
data-instgrm-captioned
|
||||
data-instgrm-permalink="https://www.instagram.com/p/{{ .id }}"
|
||||
data-instgrm-version="14"
|
||||
style="
|
||||
background: #fff;
|
||||
border: 0;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.5), 0 1px 10px 0 rgba(0, 0, 0, 0.15);
|
||||
margin: 1px;
|
||||
max-width: 540px;
|
||||
min-width: 326px;
|
||||
padding: 0;
|
||||
width: 99.375%;
|
||||
width: -webkit-calc(100% - 2px);
|
||||
width: calc(100% - 2px);
|
||||
"
|
||||
>
|
||||
<div style="padding: 16px">
|
||||
<a
|
||||
href="https://www.instagram.com/p/{{ .id }}"
|
||||
style="
|
||||
background: #ffffff;
|
||||
line-height: 0;
|
||||
padding: 0 0;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
width: 100%;
|
||||
"
|
||||
target="_blank"
|
||||
>
|
||||
<div style="display: flex; flex-direction: row; align-items: center">
|
||||
<div
|
||||
style="
|
||||
background-color: #f4f4f4;
|
||||
border-radius: 50%;
|
||||
flex-grow: 0;
|
||||
height: 40px;
|
||||
margin-right: 14px;
|
||||
width: 40px;
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
justify-content: center;
|
||||
"
|
||||
>
|
||||
<div
|
||||
style="
|
||||
background-color: #f4f4f4;
|
||||
border-radius: 4px;
|
||||
flex-grow: 0;
|
||||
height: 14px;
|
||||
margin-bottom: 6px;
|
||||
width: 100px;
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
style="
|
||||
background-color: #f4f4f4;
|
||||
border-radius: 4px;
|
||||
flex-grow: 0;
|
||||
height: 14px;
|
||||
width: 60px;
|
||||
"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding: 19% 0"></div>
|
||||
<div
|
||||
style="display: block; height: 50px; margin: 0 auto 12px; width: 50px"
|
||||
>
|
||||
<svg
|
||||
width="50px"
|
||||
height="50px"
|
||||
viewBox="0 0 60 60"
|
||||
version="1.1"
|
||||
xmlns="https://www.w3.org/2000/svg"
|
||||
xmlns:xlink="https://www.w3.org/1999/xlink"
|
||||
>
|
||||
<g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<g transform="translate(-511.000000, -20.000000)" fill="#000000">
|
||||
<g>
|
||||
<path
|
||||
d="M556.869,30.41 C554.814,30.41 553.148,32.076 553.148,34.131 C553.148,36.186 554.814,37.852 556.869,37.852 C558.924,37.852 560.59,36.186 560.59,34.131 C560.59,32.076 558.924,30.41 556.869,30.41 M541,60.657 C535.114,60.657 530.342,55.887 530.342,50 C530.342,44.114 535.114,39.342 541,39.342 C546.887,39.342 551.658,44.114 551.658,50 C551.658,55.887 546.887,60.657 541,60.657 M541,33.886 C532.1,33.886 524.886,41.1 524.886,50 C524.886,58.899 532.1,66.113 541,66.113 C549.9,66.113 557.115,58.899 557.115,50 C557.115,41.1 549.9,33.886 541,33.886 M565.378,62.101 C565.244,65.022 564.756,66.606 564.346,67.663 C563.803,69.06 563.154,70.057 562.106,71.106 C561.058,72.155 560.06,72.803 558.662,73.347 C557.607,73.757 556.021,74.244 553.102,74.378 C549.944,74.521 548.997,74.552 541,74.552 C533.003,74.552 532.056,74.521 528.898,74.378 C525.979,74.244 524.393,73.757 523.338,73.347 C521.94,72.803 520.942,72.155 519.894,71.106 C518.846,70.057 518.197,69.06 517.654,67.663 C517.244,66.606 516.755,65.022 516.623,62.101 C516.479,58.943 516.448,57.996 516.448,50 C516.448,42.003 516.479,41.056 516.623,37.899 C516.755,34.978 517.244,33.391 517.654,32.338 C518.197,30.938 518.846,29.942 519.894,28.894 C520.942,27.846 521.94,27.196 523.338,26.654 C524.393,26.244 525.979,25.756 528.898,25.623 C532.057,25.479 533.004,25.448 541,25.448 C548.997,25.448 549.943,25.479 553.102,25.623 C556.021,25.756 557.607,26.244 558.662,26.654 C560.06,27.196 561.058,27.846 562.106,28.894 C563.154,29.942 563.803,30.938 564.346,32.338 C564.756,33.391 565.244,34.978 565.378,37.899 C565.522,41.056 565.552,42.003 565.552,50 C565.552,57.996 565.522,58.943 565.378,62.101 M570.82,37.631 C570.674,34.438 570.167,32.258 569.425,30.349 C568.659,28.377 567.633,26.702 565.965,25.035 C564.297,23.368 562.623,22.342 560.652,21.575 C558.743,20.834 556.562,20.326 553.369,20.18 C550.169,20.033 549.148,20 541,20 C532.853,20 531.831,20.033 528.631,20.18 C525.438,20.326 523.257,20.834 521.349,21.575 C519.376,22.342 517.703,23.368 516.035,25.035 C514.368,26.702 513.342,28.377 512.574,30.349 C511.834,32.258 511.326,34.438 511.181,37.631 C511.035,40.831 511,41.851 511,50 C511,58.147 511.035,59.17 511.181,62.369 C511.326,65.562 511.834,67.743 512.574,69.651 C513.342,71.625 514.368,73.296 516.035,74.965 C517.703,76.634 519.376,77.658 521.349,78.425 C523.257,79.167 525.438,79.673 528.631,79.82 C531.831,79.965 532.853,80.001 541,80.001 C549.148,80.001 550.169,79.965 553.369,79.82 C556.562,79.673 558.743,79.167 560.652,78.425 C562.623,77.658 564.297,76.634 565.965,74.965 C567.633,73.296 568.659,71.625 569.425,69.651 C570.167,67.743 570.674,65.562 570.82,62.369 C570.966,59.17 571,58.147 571,50 C571,41.851 570.966,40.831 570.82,37.631"
|
||||
></path>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
<div style="padding-top: 8px">
|
||||
<div
|
||||
style="
|
||||
color: #3897f0;
|
||||
font-family: Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: 550;
|
||||
line-height: 18px;
|
||||
"
|
||||
>
|
||||
View this post on Instagram
|
||||
</div>
|
||||
</div>
|
||||
<div style="padding: 12.5% 0"></div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
margin-bottom: 14px;
|
||||
align-items: center;
|
||||
"
|
||||
>
|
||||
<div>
|
||||
<div
|
||||
style="
|
||||
background-color: #f4f4f4;
|
||||
border-radius: 50%;
|
||||
height: 12.5px;
|
||||
width: 12.5px;
|
||||
transform: translateX(0px) translateY(7px);
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
style="
|
||||
background-color: #f4f4f4;
|
||||
height: 12.5px;
|
||||
transform: rotate(-45deg) translateX(3px) translateY(1px);
|
||||
width: 12.5px;
|
||||
flex-grow: 0;
|
||||
margin-right: 14px;
|
||||
margin-left: 2px;
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
style="
|
||||
background-color: #f4f4f4;
|
||||
border-radius: 50%;
|
||||
height: 12.5px;
|
||||
width: 12.5px;
|
||||
transform: translateX(9px) translateY(-18px);
|
||||
"
|
||||
></div>
|
||||
</div>
|
||||
<div style="margin-left: 8px">
|
||||
<div
|
||||
style="
|
||||
background-color: #f4f4f4;
|
||||
border-radius: 50%;
|
||||
flex-grow: 0;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
style="
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 2px solid transparent;
|
||||
border-left: 6px solid #f4f4f4;
|
||||
border-bottom: 2px solid transparent;
|
||||
transform: translateX(16px) translateY(-4px) rotate(30deg);
|
||||
"
|
||||
></div>
|
||||
</div>
|
||||
<div style="margin-left: auto">
|
||||
<div
|
||||
style="
|
||||
width: 0px;
|
||||
border-top: 8px solid #f4f4f4;
|
||||
border-right: 8px solid transparent;
|
||||
transform: translateY(16px);
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
style="
|
||||
background-color: #f4f4f4;
|
||||
flex-grow: 0;
|
||||
height: 12px;
|
||||
width: 16px;
|
||||
transform: translateY(-4px);
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
style="
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-top: 8px solid #f4f4f4;
|
||||
border-left: 8px solid transparent;
|
||||
transform: translateY(-4px) translateX(8px);
|
||||
"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
justify-content: center;
|
||||
margin-bottom: 24px;
|
||||
"
|
||||
>
|
||||
<div
|
||||
style="
|
||||
background-color: #f4f4f4;
|
||||
border-radius: 4px;
|
||||
flex-grow: 0;
|
||||
height: 14px;
|
||||
margin-bottom: 6px;
|
||||
width: 224px;
|
||||
"
|
||||
></div>
|
||||
<div
|
||||
style="
|
||||
background-color: #f4f4f4;
|
||||
border-radius: 4px;
|
||||
flex-grow: 0;
|
||||
height: 14px;
|
||||
width: 144px;
|
||||
"
|
||||
></div></div
|
||||
></a>
|
||||
</div>
|
||||
</blockquote>
|
||||
{{- if not .pc.Simple -}}
|
||||
<script async src="https://www.instagram.com/embed.js"></script>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@@ -0,0 +1 @@
|
||||
{{- errorf `The %q shortcode was removed in v0.123.0. Use the "instagram" shortcode instead. See %s` .Name .Position -}}
|
4
tpl/tplimpl/embedded/templates/_shortcodes/param.html
Normal file
4
tpl/tplimpl/embedded/templates/_shortcodes/param.html
Normal file
@@ -0,0 +1,4 @@
|
||||
{{- $name := (.Get 0) -}}
|
||||
{{- with $name -}}
|
||||
{{- with ($.Page.Param .) }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}}
|
||||
{{- else }}{{ errorf "Missing param key: %s" $.Position }}{{ end -}}
|
79
tpl/tplimpl/embedded/templates/_shortcodes/qr.html
Normal file
79
tpl/tplimpl/embedded/templates/_shortcodes/qr.html
Normal file
@@ -0,0 +1,79 @@
|
||||
{{- /*
|
||||
Encodes the given text into a QR code using the specified options and renders the resulting image.
|
||||
|
||||
@param {string} text The text to encode, falling back to the text between the opening and closing shortcode tags.
|
||||
@param {string} [level=medium] The error correction level to use when encoding the text, one of low, medium, quartile, or high.
|
||||
@param {int} [scale=4] The number of image pixels per QR code module. Must be greater than or equal to 2.
|
||||
@param {string} [targetDir] The subdirectory within the publishDir where Hugo will place the generated image.
|
||||
@param {string} [alt] The alt attribute of the img element.
|
||||
@param {string} [class] The class attribute of the img element.
|
||||
@param {string} [id] The id attribute of the img element.
|
||||
@param {string} [title] The title attribute of the img element.
|
||||
@param {string} [loading] The loading attribute of the img element, one of lazy or eager.
|
||||
|
||||
@returns {template.HTML}
|
||||
|
||||
@examples
|
||||
|
||||
{{< qr text="https://gohugo.io" />}}
|
||||
|
||||
{{< qr >}}
|
||||
https://gohugo.io"
|
||||
{{< /qr >}}
|
||||
|
||||
{{< qr
|
||||
text="https://gohugo.io"
|
||||
level="high"
|
||||
scale=4
|
||||
targetDir="codes"
|
||||
alt="QR code linking to https://gohugo.io"
|
||||
class="my-class"
|
||||
id="my-id"
|
||||
title="My Title"
|
||||
/>}}
|
||||
|
||||
*/}}
|
||||
|
||||
{{- /* Constants. */}}
|
||||
{{- $validLevels := slice "low" "medium" "quartile" "high" }}
|
||||
{{- $minimumScale := 2 }}
|
||||
|
||||
{{- /* Get arguments. */}}
|
||||
{{- $text := or (.Get "text") (strings.TrimSpace .Inner) "" }}
|
||||
{{- $level := or (.Get "level") "medium" }}
|
||||
{{- $scale := or (.Get "scale") 4 }}
|
||||
{{- $targetDir := or (.Get "targetDir") "" }}
|
||||
{{- $alt := or (.Get "alt") "" }}
|
||||
{{- $class := or (.Get "class") "" }}
|
||||
{{- $id := or (.Get "id") "" }}
|
||||
{{- $title := or (.Get "title") "" }}
|
||||
{{- $loading := or (.Get "loading") "" }}
|
||||
|
||||
{{- /* Validate arguments. */}}
|
||||
{{- $errors := false}}
|
||||
{{- if not $text }}
|
||||
{{- errorf "The %q shortcode requires a %q argument. See %s" .Name "text" .Position }}
|
||||
{{- $errors = true }}
|
||||
{{- end }}
|
||||
{{- if not (in $validLevels $level) }}
|
||||
{{- errorf "The %q argument passed to the %q shortcode must be one of %s. See %s" "level" .Name (delimit $validLevels ", " ", or ") .Position }}
|
||||
{{- $errors = true }}
|
||||
{{- end }}
|
||||
{{- if or (lt $scale $minimumScale) (ne $scale (int $scale)) }}
|
||||
{{- errorf "The %q argument passed to the %q shortcode must be an integer greater than or equal to %d. See %s" "scale" .Name $minimumScale .Position }}
|
||||
{{- $errors = true }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Render image. */}}
|
||||
{{- if not $errors }}
|
||||
{{- $opts := dict "level" $level "scale" $scale "targetDir" $targetDir }}
|
||||
{{- with images.QR $text $opts -}}
|
||||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}"
|
||||
{{- with $alt }} alt="{{ $alt }}" {{- end }}
|
||||
{{- with $class }} class="{{ $class }}" {{- end }}
|
||||
{{- with $id }} id="{{ $id }}" {{- end }}
|
||||
{{- with $title }} title="{{ $title }}" {{- end -}}
|
||||
{{- with $loading }} loading="{{ $loading }}" {{- end -}}
|
||||
>
|
||||
{{- end }}
|
||||
{{- end -}}
|
1
tpl/tplimpl/embedded/templates/_shortcodes/ref.html
Normal file
1
tpl/tplimpl/embedded/templates/_shortcodes/ref.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ ref . .Params }}
|
1
tpl/tplimpl/embedded/templates/_shortcodes/relref.html
Normal file
1
tpl/tplimpl/embedded/templates/_shortcodes/relref.html
Normal file
@@ -0,0 +1 @@
|
||||
{{ relref . .Params }}
|
30
tpl/tplimpl/embedded/templates/_shortcodes/twitter.html
Normal file
30
tpl/tplimpl/embedded/templates/_shortcodes/twitter.html
Normal file
@@ -0,0 +1,30 @@
|
||||
{{- warnf "The \"twitter\", \"tweet\", and \"twitter_simple\" shortcodes were deprecated in v0.142.0 and will be removed in a future release. Please use the \"x\" shortcode instead." }}
|
||||
{{- $pc := site.Config.Privacy.Twitter -}}
|
||||
{{- if not $pc.Disable -}}
|
||||
{{- if $pc.Simple -}}
|
||||
{{- template "_internal/shortcodes/twitter_simple.html" . -}}
|
||||
{{- else -}}
|
||||
{{- $id := or (.Get "id") "" -}}
|
||||
{{- $user := or (.Get "user") "" -}}
|
||||
{{- if and $id $user -}}
|
||||
{{- template "render-tweet" (dict "id" $id "user" $user "dnt" $pc.EnableDNT "ctx" .) -}}
|
||||
{{- else -}}
|
||||
{{- errorf "The %q shortcode requires two named parameters: user and id. See %s" .Name .Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "render-tweet" -}}
|
||||
{{- $url := printf "https://twitter.com/%v/status/%v" .user .id -}}
|
||||
{{- $query := querify "url" $url "dnt" .dnt -}}
|
||||
{{- $request := printf "https://publish.twitter.com/oembed?%s" $query -}}
|
||||
{{- with try (resources.GetRemote $request) -}}
|
||||
{{- with .Err -}}
|
||||
{{- errorf "%s" . -}}
|
||||
{{- else with .Value -}}
|
||||
{{- (. | transform.Unmarshal).html | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- warnidf "shortcode-twitter-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" $.ctx.Name $.ctx.Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
@@ -0,0 +1,61 @@
|
||||
{{- warnf "The \"twitter\", \"tweet\", and \"twitter_simple\" shortcodes were deprecated in v0.142.0 and will be removed in a future release. Please use the \"x\" shortcode instead." }}
|
||||
{{- if not site.Config.Privacy.Twitter.Disable -}}
|
||||
{{- $id := or (.Get "id") "" -}}
|
||||
{{- $user := or (.Get "user") "" -}}
|
||||
{{- if and $id $user -}}
|
||||
{{- template "render-simple-tweet" (dict "id" $id "user" $user "ctx" .) -}}
|
||||
{{- else -}}
|
||||
{{- errorf "The %q shortcode requires two named parameters: user and id. See %s" .Name .Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "render-simple-tweet" -}}
|
||||
{{- $dnt := site.Config.Privacy.Twitter.EnableDNT }}
|
||||
{{- $url := printf "https://twitter.com/%v/status/%v" .user .id -}}
|
||||
{{- $query := querify "url" $url "dnt" $dnt "omit_script" true -}}
|
||||
{{- $request := printf "https://publish.twitter.com/oembed?%s" $query -}}
|
||||
{{- with try (resources.GetRemote $request) -}}
|
||||
{{- with .Err -}}
|
||||
{{- errorf "%s" . -}}
|
||||
{{- else with .Value -}}
|
||||
{{- if not site.Config.Services.Twitter.DisableInlineCSS }}
|
||||
{{- template "__h_simple_twitter_css" (dict "ctx" $.ctx) }}
|
||||
{{- end }}
|
||||
{{- (. | transform.Unmarshal).html | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- warnidf "shortcode-twitter-simple-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" $.ctx.Name $.ctx.Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "__h_simple_twitter_css" -}}
|
||||
{{- if not (.ctx.Page.Store.Get "__h_simple_twitter_css") -}}
|
||||
{{/* Only include once */}}
|
||||
{{- .ctx.Page.Store.Set "__h_simple_twitter_css" true -}}
|
||||
<style type="text/css">
|
||||
.twitter-tweet {
|
||||
font:
|
||||
14px/1.45 -apple-system,
|
||||
BlinkMacSystemFont,
|
||||
"Segoe UI",
|
||||
Roboto,
|
||||
Oxygen-Sans,
|
||||
Ubuntu,
|
||||
Cantarell,
|
||||
"Helvetica Neue",
|
||||
sans-serif;
|
||||
border-left: 4px solid #2b7bb9;
|
||||
padding-left: 1.5em;
|
||||
color: #555;
|
||||
}
|
||||
.twitter-tweet a {
|
||||
color: #2b7bb9;
|
||||
text-decoration: none;
|
||||
}
|
||||
blockquote.twitter-tweet a:hover,
|
||||
blockquote.twitter-tweet a:focus {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
67
tpl/tplimpl/embedded/templates/_shortcodes/vimeo.html
Normal file
67
tpl/tplimpl/embedded/templates/_shortcodes/vimeo.html
Normal file
@@ -0,0 +1,67 @@
|
||||
{{- /*
|
||||
Renders an embedded Vimeo video.
|
||||
|
||||
Accepts named or positional arguments. If positional, order is id, class,
|
||||
title, then loading.
|
||||
|
||||
@param {string} [id] The video id. Optional if the id is provided as first positional argument.
|
||||
@param {string} [class] The class attribute of the wrapping div element. When specified, removes the style attributes from the iframe element and its wrapping div element.
|
||||
@param {string} [loading=eager] The loading attribute of the iframe element.
|
||||
@param {string} [title=Vimeo video] The title attribute of the iframe element.
|
||||
@param {bool} [allowFullScreen=true] Whether the iframe element can activate full screen mode.
|
||||
|
||||
@returns {template.HTML}
|
||||
|
||||
@example {{< vimeo 55073825 >}}
|
||||
@example {{< vimeo id=55073825 class="foo bar" loading=lazy title="My Video" >}}
|
||||
*/}}
|
||||
{{- $pc := site.Config.Privacy.Vimeo }}
|
||||
{{- if not $pc.Disable }}
|
||||
{{- if $pc.Simple }}
|
||||
{{- template "_internal/shortcodes/vimeo_simple.html" . }}
|
||||
{{- else }}
|
||||
{{- $dnt := cond $pc.EnableDNT 1 0 }}
|
||||
|
||||
{{- $id := or (.Get "id") (.Get 0) "" }}
|
||||
{{- $class := or (.Get "class") (.Get 1) "" }}
|
||||
{{- $title := or (.Get "title") (.Get 2) "Vimeo video" }}
|
||||
{{- $loading := or (.Get "loading") (.Get 3) "eager" }}
|
||||
{{- $allowFullScreen := or (.Get "allowFullScreen") (.Get 4) true }}
|
||||
|
||||
{{- if in (slice "false" false 0) ($.Get "allowFullScreen") }}
|
||||
{{- $allowFullScreen = false }}
|
||||
{{- else if in (slice "true" true 1) ($.Get "allowFullScreen") }}
|
||||
{{- $allowFullScreen = true }}
|
||||
{{- end }}
|
||||
|
||||
{{- $iframeAllowList := "" }}
|
||||
{{- if $allowFullScreen }}
|
||||
{{- $iframeAllowList = "fullscreen" }}
|
||||
{{- end }}
|
||||
|
||||
{{- $divStyle := "position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;" }}
|
||||
{{- $iframeStyle := "position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" }}
|
||||
|
||||
{{- with $id }}
|
||||
{{- $src := printf "https://player.vimeo.com/video/%v?dnt=%v" . $dnt }}
|
||||
<div
|
||||
{{- with $class }}
|
||||
class="{{ . }}"
|
||||
{{- else }}
|
||||
style="{{ $divStyle | safeCSS }}"
|
||||
{{- end }}>
|
||||
<iframe
|
||||
src="{{- $src }}"
|
||||
{{- if not $class }}
|
||||
style="{{ $iframeStyle | safeCSS }}"
|
||||
{{- end }}
|
||||
{{- with $iframeAllowList }} allow="{{ . }}" {{- end }}
|
||||
{{- with $loading }} loading="{{ . }}" {{- end }}
|
||||
{{- with $title }} title="{{ . }}" {{- end }}>
|
||||
</iframe>
|
||||
</div>
|
||||
{{- else }}
|
||||
{{- errorf "The %q shortcode requires a video id, either as the first positional argument or an argument named id. See %s" .Name .Position }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
52
tpl/tplimpl/embedded/templates/_shortcodes/vimeo_simple.html
Normal file
52
tpl/tplimpl/embedded/templates/_shortcodes/vimeo_simple.html
Normal file
@@ -0,0 +1,52 @@
|
||||
{{- $pc := site.Config.Privacy.Vimeo -}}
|
||||
{{- if not $pc.Disable -}}
|
||||
{{- $ctx := dict "ctx" . }}
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- with .Get "id" -}}
|
||||
{{- $ctx = merge $ctx (dict "id" . "class" ($.Get "class")) -}}
|
||||
{{- template "render-vimeo" $ctx -}}
|
||||
{{- else -}}
|
||||
{{- errorf "The %q shortocde requires a single named parameter, the ID of the Vimeo video. See %s" .Name .Position -}}
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- with .Get 0 -}}
|
||||
{{- $ctx = merge $ctx (dict "id" . "class" ($.Get 1)) -}}
|
||||
{{- template "render-vimeo" $ctx -}}
|
||||
{{- else -}}
|
||||
{{- errorf "The %q shortocde requires a single positional parameter, the ID of the Vimeo video. See %s" .Name .Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "render-vimeo" -}}
|
||||
{{- $dnt := cond site.Config.Privacy.Vimeo.EnableDNT 1 0 -}}
|
||||
{{- $url := urls.JoinPath "https://vimeo.com" .id -}}
|
||||
{{- $query := querify "url" $url "dnt" $dnt -}}
|
||||
{{- $request := printf "https://vimeo.com/api/oembed.json?%s" $query -}}
|
||||
{{- with try (resources.GetRemote $request) -}}
|
||||
{{- with .Err -}}
|
||||
{{- errorf "%s" . -}}
|
||||
{{- else with .Value -}}
|
||||
{{- with . | transform.Unmarshal -}}
|
||||
{{- $class := printf "%s %s" "s_video_simple" "__h_video" -}}
|
||||
{{- with $.class -}}
|
||||
{{- $class = printf "%s %s" "s_video_simple" . -}}
|
||||
{{- else -}}
|
||||
{{ template "__h_simple_css" $.ctx.Page }}
|
||||
{{- end -}}
|
||||
{{- $thumbnail := .thumbnail_url -}}
|
||||
{{- $original := $thumbnail | replaceRE "(_.*\\.)" "." -}}
|
||||
<div class="{{ $class }}">
|
||||
<a href="{{ .provider_url }}{{ .video_id }}" rel="noopener" target="_blank">
|
||||
<img src="{{ $thumbnail }}" srcset="{{ $thumbnail }} 1x, {{ $original }} 2x" alt="{{ .title }}">
|
||||
<div class="play">
|
||||
{{ template "__h_simple_icon_play" $.ctx.Page }}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
{{- end -}}
|
||||
{{- else -}}
|
||||
{{- warnidf "shortcode-vimeo-simple" "The %q shortcode was unable to retrieve the remote data. See %s" $.ctx.Name $.ctx.Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
29
tpl/tplimpl/embedded/templates/_shortcodes/x.html
Normal file
29
tpl/tplimpl/embedded/templates/_shortcodes/x.html
Normal file
@@ -0,0 +1,29 @@
|
||||
{{- $pc := site.Config.Privacy.X -}}
|
||||
{{- if not $pc.Disable -}}
|
||||
{{- if $pc.Simple -}}
|
||||
{{- template "_internal/shortcodes/x_simple.html" . -}}
|
||||
{{- else -}}
|
||||
{{- $id := or (.Get "id") "" -}}
|
||||
{{- $user := or (.Get "user") "" -}}
|
||||
{{- if and $id $user -}}
|
||||
{{- template "render-x" (dict "id" $id "user" $user "dnt" $pc.EnableDNT "ctx" .) -}}
|
||||
{{- else -}}
|
||||
{{- errorf "The %q shortcode requires two named parameters: user and id. See %s" .Name .Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "render-x" -}}
|
||||
{{- $url := printf "https://x.com/%v/status/%v" .user .id -}}
|
||||
{{- $query := querify "url" $url "dnt" .dnt -}}
|
||||
{{- $request := printf "https://publish.x.com/oembed?%s" $query -}}
|
||||
{{- with try (resources.GetRemote $request) -}}
|
||||
{{- with .Err -}}
|
||||
{{- errorf "%s" . -}}
|
||||
{{- else with .Value -}}
|
||||
{{- (. | transform.Unmarshal).html | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- warnidf "shortcode-x-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" $.ctx.Name $.ctx.Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
60
tpl/tplimpl/embedded/templates/_shortcodes/x_simple.html
Normal file
60
tpl/tplimpl/embedded/templates/_shortcodes/x_simple.html
Normal file
@@ -0,0 +1,60 @@
|
||||
{{- if not site.Config.Privacy.X.Disable -}}
|
||||
{{- $id := or (.Get "id") "" -}}
|
||||
{{- $user := or (.Get "user") "" -}}
|
||||
{{- if and $id $user -}}
|
||||
{{- template "render-simple-x" (dict "id" $id "user" $user "ctx" .) -}}
|
||||
{{- else -}}
|
||||
{{- errorf "The %q shortcode requires two named parameters: user and id. See %s" .Name .Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "render-simple-x" -}}
|
||||
{{- $dnt := site.Config.Privacy.X.EnableDNT }}
|
||||
{{- $url := printf "https://x.com/%v/status/%v" .user .id -}}
|
||||
{{- $query := querify "url" $url "dnt" $dnt "omit_script" true -}}
|
||||
{{- $request := printf "https://publish.x.com/oembed?%s" $query -}}
|
||||
{{- with try (resources.GetRemote $request) -}}
|
||||
{{- with .Err -}}
|
||||
{{- errorf "%s" . -}}
|
||||
{{- else with .Value -}}
|
||||
{{- if not site.Config.Services.X.DisableInlineCSS }}
|
||||
{{- template "__h_simple_x_css" (dict "ctx" $.ctx) }}
|
||||
{{- end }}
|
||||
{{- (. | transform.Unmarshal).html | safeHTML -}}
|
||||
{{- else -}}
|
||||
{{- warnidf "shortcode-x-simple-getremote" "The %q shortcode was unable to retrieve the remote data. See %s" $.ctx.Name $.ctx.Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "__h_simple_x_css" -}}
|
||||
{{- if not (.ctx.Page.Store.Get "__h_simple_x_css") -}}
|
||||
{{/* Only include once */}}
|
||||
{{- .ctx.Page.Store.Set "__h_simple_x_css" true -}}
|
||||
<style type="text/css">
|
||||
.twitter-tweet {
|
||||
font:
|
||||
14px/1.45 -apple-system,
|
||||
BlinkMacSystemFont,
|
||||
"Segoe UI",
|
||||
Roboto,
|
||||
Oxygen-Sans,
|
||||
Ubuntu,
|
||||
Cantarell,
|
||||
"Helvetica Neue",
|
||||
sans-serif;
|
||||
border-left: 4px solid #2b7bb9;
|
||||
padding-left: 1.5em;
|
||||
color: #555;
|
||||
}
|
||||
.twitter-tweet a {
|
||||
color: #2b7bb9;
|
||||
text-decoration: none;
|
||||
}
|
||||
blockquote.twitter-tweet a:hover,
|
||||
blockquote.twitter-tweet a:focus {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
120
tpl/tplimpl/embedded/templates/_shortcodes/youtube.html
Normal file
120
tpl/tplimpl/embedded/templates/_shortcodes/youtube.html
Normal file
@@ -0,0 +1,120 @@
|
||||
{{- /*
|
||||
Renders an embedded YouTube video.
|
||||
|
||||
@param {bool} [allowFullScreen=true] Whether the iframe element can activate full screen mode.
|
||||
@param {bool} [autoplay=false] Whether to automatically play the video. Forces mute to be true.
|
||||
@param {string} [class] The class attribute of the wrapping div element. When specified, removes the style attributes from the iframe element and its wrapping div element.
|
||||
@param {bool} [controls=true] Whether to display the video controls.
|
||||
@param {int} [end] The time, measured in seconds from the start of the video, when the player should stop playing the video.
|
||||
@param {string} [id] The video id. Optional if the id is provided as first positional argument.
|
||||
@param {string} [loading=eager] The loading attribute of the iframe element.
|
||||
@param {bool} [loop=false] Whether to indefinitely repeat the video. Ignores the start and end arguments after the first play.
|
||||
@param {bool} [mute=false] Whether to mute the video. Always true when autoplay is true.
|
||||
@param {int} [start] The time, measured in seconds from the start of the video, when the player should start playing the video.
|
||||
@param {string} [title] The title attribute of the iframe element. Defaults to "YouTube video".
|
||||
|
||||
@returns {template.HTML}
|
||||
|
||||
@reference https://developers.google.com/youtube/player_parameters
|
||||
|
||||
@example {{< youtube 0RKpf3rK57I >}}
|
||||
@example {{< youtube id=0RKpf3rK57I loading=lazy start=30 >}}
|
||||
*/}}
|
||||
|
||||
{{- $pc := .Page.Site.Config.Privacy.YouTube }}
|
||||
{{- $remoteErrID := "err-youtube-remote" }}
|
||||
{{- if not $pc.Disable }}
|
||||
{{- with $id := or (.Get "id") (.Get 0) }}
|
||||
|
||||
{{- /* Set defaults. */}}
|
||||
{{- $allowFullScreen := true }}
|
||||
{{- $autoplay := 0 }}
|
||||
{{- $class := "" }}
|
||||
{{- $controls := 1 }}
|
||||
{{- $end := 0 }}
|
||||
{{- $loading := "eager" }}
|
||||
{{- $loop := 0 }}
|
||||
{{- $mute := 0 }}
|
||||
{{- $start := 0 }}
|
||||
{{- $title := "YouTube video" }}
|
||||
{{- $iframeAllowList := "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" }}
|
||||
|
||||
{{- /* Get arguments. */}}
|
||||
{{- if in (slice "true" true 1) ($.Get "allowFullScreen") }}
|
||||
{{- $iframeAllowList = printf "%s; fullscreen" $iframeAllowList }}
|
||||
{{- end }}
|
||||
{{- if in (slice "false" false 0) ($.Get "autoplay") }}
|
||||
{{- $autoplay = 0 }}
|
||||
{{- else if in (slice "true" true 1) ($.Get "autoplay") }}
|
||||
{{- $autoplay = 1 }}
|
||||
{{- end }}
|
||||
{{- if in (slice "false" false 0) ($.Get "controls") }}
|
||||
{{- $controls = 0 }}
|
||||
{{- else if in (slice "true" true 1) ($.Get "controls") }}
|
||||
{{- $controls = 1 }}
|
||||
{{- end }}
|
||||
{{- if in (slice "false" false 0) ($.Get "loop") }}
|
||||
{{- $loop = 0 }}
|
||||
{{- else if in (slice "true" true 1) ($.Get "loop") }}
|
||||
{{- $loop = 1 }}
|
||||
{{- end }}
|
||||
{{- if in (slice "false" false 0) ($.Get "mute") }}
|
||||
{{- $mute = 0 }}
|
||||
{{- else if or (in (slice "true" true 1) ($.Get "mute")) $autoplay }}
|
||||
{{- $mute = 1 }}
|
||||
{{- end }}
|
||||
{{- $class := or ($.Get "class") $class }}
|
||||
{{- $end := or ($.Get "end") $end }}
|
||||
{{- $loading := or ($.Get "loading") $loading }}
|
||||
{{- $start := or ($.Get "start") $start }}
|
||||
{{- $title := or ($.Get "title") $title }}
|
||||
|
||||
{{- /* Define src attribute. */}}
|
||||
{{- $host := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" }}
|
||||
{{- $src := printf "https://%s/embed/%s" $host $id }}
|
||||
{{- $params := dict
|
||||
"autoplay" $autoplay
|
||||
"controls" $controls
|
||||
"end" $end
|
||||
"mute" $mute
|
||||
"start" $start
|
||||
"loop" $loop
|
||||
}}
|
||||
{{- if $loop }}
|
||||
{{- $params = merge $params (dict "playlist" $id) }}
|
||||
{{- end }}
|
||||
{{- with querify $params }}
|
||||
{{- $src = printf "%s?%s" $src . }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Set div attributes. */}}
|
||||
{{- $divStyle := "position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;" }}
|
||||
{{- if $class }}
|
||||
{{- $divStyle = "" }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* Set iframe attributes. */}}
|
||||
{{- $iframeStyle := "position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" }}
|
||||
{{- if $class }}
|
||||
{{- $iframeStyle = "" }}
|
||||
{{- end }}
|
||||
{{- $referrerpolicy := "strict-origin-when-cross-origin" }}
|
||||
|
||||
{{- /* Render. */ -}}
|
||||
<div
|
||||
{{- with $class }} class="{{ . }}" {{- end }}
|
||||
{{- with $divStyle }} style="{{ . | safeCSS }}" {{- end -}}
|
||||
>
|
||||
<iframe
|
||||
{{- with $iframeAllowList }} allow="{{ . }}" {{- end }}
|
||||
{{- with $loading }} loading="{{ . }}" {{- end }}
|
||||
{{- with $referrerpolicy }} referrerpolicy="{{ . }}" {{- end }}
|
||||
{{- with $src }} src="{{ . }}" {{- end }}
|
||||
{{- with $iframeStyle}} style="{{ . | safeCSS }}" {{- end }}
|
||||
{{- with $title }} title="{{ . }}" {{- end -}}
|
||||
></iframe>
|
||||
</div>
|
||||
{{- else }}
|
||||
{{- errorf "The %q shortcode requires an id argument. See %s" .Name .Position }}
|
||||
{{- end }}
|
||||
{{- end }}
|
Reference in New Issue
Block a user