mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
tpl: Run gotmplfmt -w .
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
{{ range $i, $e := .Scripts -}}
|
||||
{{ printf "import { %s as Script%d } from %q;" .Export $i .Import }}
|
||||
{{ printf "import { %s as Script%d } from %q;" .Export $i .Import }}
|
||||
{{ end -}}
|
||||
{{ range $i, $e := .Runners }}
|
||||
{{ printf "import { %s as Run%d } from %q;" .Export $i .Import }}
|
||||
{{ printf "import { %s as Run%d } from %q;" .Export $i .Import }}
|
||||
{{ end }}
|
||||
{{/* */}}
|
||||
let scripts = [];
|
||||
{{ range $i, $e := .Scripts -}}
|
||||
scripts.push({{ .RunnerJSON $i }});
|
||||
scripts.push({{ .RunnerJSON $i }});
|
||||
{{ end -}}
|
||||
{{/* */}}
|
||||
{{ range $i, $e := .Runners }}
|
||||
{{ $id := printf "Run%d" $i }}
|
||||
{{ $id }}(scripts);
|
||||
{{ $id := printf "Run%d" $i }}
|
||||
{{ $id }}(scripts);
|
||||
{{ end }}
|
||||
|
||||
@@ -2,17 +2,17 @@
|
||||
{{ $height := .Attributes.height }}
|
||||
{{ $class := .Attributes.class | default "" }}
|
||||
<div class="goat svg-container {{ $class }}">
|
||||
{{ with diagrams.Goat .Inner }}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
font-family="Menlo,Lucida Console,monospace"
|
||||
{{ if or $width $height }}
|
||||
{{ with $width }}width="{{ . }}"{{ end }}
|
||||
{{ with $height }}height="{{ . }}"{{ end }}
|
||||
{{ else }}
|
||||
viewBox="0 0 {{ .Width }} {{ .Height }}"
|
||||
{{ end }}>
|
||||
{{ .Inner }}
|
||||
</svg>
|
||||
{{ end }}
|
||||
{{ with diagrams.Goat .Inner }}
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
font-family="Menlo,Lucida Console,monospace"
|
||||
{{ if or $width $height }}
|
||||
{{ with $width }}width="{{ . }}"{{ end }}
|
||||
{{ with $height }}height="{{ . }}"{{ end }}
|
||||
{{ else }}
|
||||
viewBox="0 0 {{ .Width }} {{ .Height }}"
|
||||
{{ end }}>
|
||||
{{ .Inner }}
|
||||
</svg>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
{{- $u := urls.Parse .Destination -}}
|
||||
{{- $src := $u.String -}}
|
||||
{{- if not $u.IsAbs -}}
|
||||
{{- $path := strings.TrimPrefix "./" $u.Path -}}
|
||||
{{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
|
||||
{{- $src = .RelPermalink -}}
|
||||
{{- with $u.RawQuery -}}
|
||||
{{- $src = printf "%s?%s" $src . -}}
|
||||
{{- end -}}
|
||||
{{- with $u.Fragment -}}
|
||||
{{- $src = printf "%s#%s" $src . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $path := strings.TrimPrefix "./" $u.Path -}}
|
||||
{{- with or (.PageInner.Resources.Get $path) (resources.Get $path) -}}
|
||||
{{- $src = .RelPermalink -}}
|
||||
{{- with $u.RawQuery -}}
|
||||
{{- $src = printf "%s?%s" $src . -}}
|
||||
{{- end -}}
|
||||
{{- with $u.Fragment -}}
|
||||
{{- $src = printf "%s#%s" $src . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
<img src="{{ $src }}" alt="{{ .PlainText }}"
|
||||
{{- with .Title }} title="{{ . }}" {{- end -}}
|
||||
{{- range $k, $v := .Attributes -}}
|
||||
{{- if $v -}}
|
||||
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
>
|
||||
{{- with .Title }} title="{{ . }}" {{- end -}}
|
||||
{{- range $k, $v := .Attributes -}}
|
||||
{{- if $v -}}
|
||||
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr -}}
|
||||
{{- end -}}
|
||||
{{- end -}}>
|
||||
{{- /**/ -}}
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
{{- $u := urls.Parse .Destination -}}
|
||||
{{- $href := $u.String -}}
|
||||
{{- if strings.HasPrefix $u.String "#" -}}
|
||||
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment -}}
|
||||
{{- $href = printf "%s#%s" .PageInner.RelPermalink $u.Fragment -}}
|
||||
{{- else if and $href (not $u.IsAbs) -}}
|
||||
{{- $path := strings.TrimPrefix "./" $u.Path -}}
|
||||
{{- with or
|
||||
($.PageInner.GetPage $path)
|
||||
($.PageInner.Resources.Get $path)
|
||||
(resources.Get $path)
|
||||
-}}
|
||||
{{- $href = .RelPermalink -}}
|
||||
{{- with $u.RawQuery -}}
|
||||
{{- $href = printf "%s?%s" $href . -}}
|
||||
{{- end -}}
|
||||
{{- with $u.Fragment -}}
|
||||
{{- $href = printf "%s#%s" $href . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $path := strings.TrimPrefix "./" $u.Path -}}
|
||||
{{- with or
|
||||
($.PageInner.GetPage $path)
|
||||
($.PageInner.Resources.Get $path)
|
||||
(resources.Get $path)
|
||||
-}}
|
||||
{{- $href = .RelPermalink -}}
|
||||
{{- with $u.RawQuery -}}
|
||||
{{- $href = printf "%s?%s" $href . -}}
|
||||
{{- end -}}
|
||||
{{- with $u.Fragment -}}
|
||||
{{- $href = printf "%s#%s" $href . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
<a href="{{ $href }}" {{- with .Title }} title="{{ . }}" {{- end }}>{{ .Text }}</a>
|
||||
{{- /**/ -}}
|
||||
|
||||
@@ -1,37 +1,35 @@
|
||||
<table
|
||||
{{- range $k, $v := .Attributes }}
|
||||
{{- if $v }}
|
||||
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
<thead>
|
||||
{{- range .THead }}
|
||||
<tr>
|
||||
{{- range . }}
|
||||
<th
|
||||
{{- with .Alignment }}
|
||||
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
|
||||
{{- end -}}
|
||||
>
|
||||
{{- .Text -}}
|
||||
</th>
|
||||
{{- end }}
|
||||
</tr>
|
||||
{{- end }}
|
||||
</thead>
|
||||
<tbody>
|
||||
{{- range .TBody }}
|
||||
<tr>
|
||||
{{- range . }}
|
||||
<td
|
||||
{{- with .Alignment }}
|
||||
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
|
||||
{{- end -}}
|
||||
>
|
||||
{{- .Text -}}
|
||||
</td>
|
||||
{{- end }}
|
||||
</tr>
|
||||
{{- end }}
|
||||
</tbody>
|
||||
{{- range $k, $v := .Attributes }}
|
||||
{{- if $v }}
|
||||
{{- printf " %s=%q" $k ($v | transform.HTMLEscape) | safeHTMLAttr }}
|
||||
{{- end }}
|
||||
{{- end }}>
|
||||
<thead>
|
||||
{{- range .THead }}
|
||||
<tr>
|
||||
{{- range . }}
|
||||
<th
|
||||
{{- with .Alignment }}
|
||||
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
|
||||
{{- end -}}>
|
||||
{{- .Text -}}
|
||||
</th>
|
||||
{{- end }}
|
||||
</tr>
|
||||
{{- end }}
|
||||
</thead>
|
||||
<tbody>
|
||||
{{- range .TBody }}
|
||||
<tr>
|
||||
{{- range . }}
|
||||
<td
|
||||
{{- with .Alignment }}
|
||||
{{- printf " style=%q" (printf "text-align: %s" .) | safeHTMLAttr }}
|
||||
{{- end -}}>
|
||||
{{- .Text -}}
|
||||
</td>
|
||||
{{- end }}
|
||||
</tr>
|
||||
{{- end }}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -3,44 +3,50 @@
|
||||
{{- $resources := .Resources.ByType "image" -}}
|
||||
{{/* Find featured image resources if the images parameter is empty. */}}
|
||||
{{- if not $imgParams }}
|
||||
{{- $featured := $resources.GetMatch "*feature*" -}}
|
||||
{{- if not $featured }}{{ $featured = $resources.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
{{- with $featured }}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"Image" .
|
||||
"RelPermalink" .RelPermalink
|
||||
"Permalink" .Permalink) }}
|
||||
{{- end }}
|
||||
{{- $featured := $resources.GetMatch "*feature*" -}}
|
||||
{{- if not $featured }}{{ $featured = $resources.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
|
||||
{{- with $featured }}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"Image" .
|
||||
"RelPermalink" .RelPermalink
|
||||
"Permalink" .Permalink
|
||||
)
|
||||
}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{/* Use the first one of site images as the fallback. */}}
|
||||
{{- if and (not $imgParams) (not $imgs) }}
|
||||
{{- with site.Params.images }}
|
||||
{{- $imgParams = first 1 . }}
|
||||
{{- end }}
|
||||
{{- with site.Params.images }}
|
||||
{{- $imgParams = first 1 . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{/* Parse page's images parameter. */}}
|
||||
{{- range $imgParams }}
|
||||
{{- $img := . }}
|
||||
{{- $url := urls.Parse $img }}
|
||||
{{- if eq $url.Scheme "" }}
|
||||
{{/* Internal image: check page resources first, then global resources. */}}
|
||||
{{- with or ($resources.GetMatch $img) (resources.GetMatch $img) -}}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"Image" .
|
||||
"RelPermalink" .RelPermalink
|
||||
"Permalink" .Permalink) }}
|
||||
{{- else }}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"RelPermalink" (relURL $img)
|
||||
"Permalink" (absURL $img)
|
||||
) }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{/* External image */}}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"RelPermalink" $img
|
||||
"Permalink" $img
|
||||
) }}
|
||||
{{- end }}
|
||||
{{- $img := . }}
|
||||
{{- $url := urls.Parse $img }}
|
||||
{{- if eq $url.Scheme "" }}
|
||||
{{/* Internal image: check page resources first, then global resources. */}}
|
||||
{{- with or ($resources.GetMatch $img) (resources.GetMatch $img) -}}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"Image" .
|
||||
"RelPermalink" .RelPermalink
|
||||
"Permalink" .Permalink
|
||||
)
|
||||
}}
|
||||
{{- else }}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"RelPermalink" (relURL $img)
|
||||
"Permalink" (absURL $img)
|
||||
)
|
||||
}}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{/* External image */}}
|
||||
{{- $imgs = $imgs | append (dict
|
||||
"RelPermalink" $img
|
||||
"Permalink" $img
|
||||
)
|
||||
}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- return $imgs }}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{{- $pc := .Site.Config.Privacy.Disqus -}}
|
||||
{{- if not $pc.Disable -}}
|
||||
{{ if .Site.Config.Services.Disqus.Shortname }}<div id="disqus_thread"></div>
|
||||
{{ if .Site.Config.Services.Disqus.Shortname }}<div id="disqus_thread"></div>
|
||||
<script>
|
||||
window.disqus_config = function () {
|
||||
{{with .Params.disqus_identifier }}this.page.identifier = '{{ . }}';{{end}}
|
||||
@@ -18,6 +18,7 @@
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>{{end}}
|
||||
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
|
||||
<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{ if not site.Config.Privacy.GoogleAnalytics.Disable }}
|
||||
{{- with site.Config.Services.GoogleAnalytics.ID }}
|
||||
{{- if strings.HasPrefix (lower .) "ua-" }}
|
||||
{{- warnf "Google Analytics 4 (GA4) replaced Google Universal Analytics (UA) effective 1 July 2023. See https://support.google.com/analytics/answer/11583528. Create a GA4 property and data stream, then replace the Google Analytics ID in your project configuration with the new value." }}
|
||||
{{- else }}
|
||||
{{- with site.Config.Services.GoogleAnalytics.ID }}
|
||||
{{- if strings.HasPrefix (lower .) "ua-" }}
|
||||
{{- warnf "Google Analytics 4 (GA4) replaced Google Universal Analytics (UA) effective 1 July 2023. See https://support.google.com/analytics/answer/11583528. Create a GA4 property and data stream, then replace the Google Analytics ID in your project configuration with the new value." }}
|
||||
{{- else }}
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ . }}"></script>
|
||||
<script>
|
||||
var doNotTrack = false;
|
||||
@@ -17,6 +17,6 @@
|
||||
gtag('config', '{{ . }}');
|
||||
}
|
||||
</script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,74 +1,74 @@
|
||||
<meta property="og:url" content="{{ .Permalink }}">
|
||||
|
||||
{{- with or site.Title site.Params.title | plainify }}
|
||||
<meta property="og:site_name" content="{{ . }}">
|
||||
<meta property="og:site_name" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- with or .Title site.Title site.Params.title | plainify }}
|
||||
<meta property="og:title" content="{{ . }}">
|
||||
<meta property="og:title" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- with or .Description .Summary site.Params.description | plainify | htmlUnescape }}
|
||||
<meta property="og:description" content="{{ trim . "\n\r\t " }}">
|
||||
<meta property="og:description" content="{{ trim . "\n\r\t " }}">
|
||||
{{- end }}
|
||||
|
||||
{{- with or .Params.locale site.Language.Locale }}
|
||||
<meta property="og:locale" content="{{ replace . `-` `_` }}">
|
||||
<meta property="og:locale" content="{{ replace . `-` `_` }}">
|
||||
{{- end }}
|
||||
|
||||
{{- if .IsPage }}
|
||||
<meta property="og:type" content="article">
|
||||
{{- with .Section }}
|
||||
<meta property="article:section" content="{{ . }}">
|
||||
{{- end }}
|
||||
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
||||
{{- with .PublishDate }}
|
||||
<meta property="article:published_time" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
{{- with .Lastmod }}
|
||||
<meta property="article:modified_time" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
{{- range .GetTerms "tags" | first 6 }}
|
||||
<meta property="article:tag" content="{{ .Page.Title | plainify }}">
|
||||
{{- end }}
|
||||
<meta property="og:type" content="article">
|
||||
{{- with .Section }}
|
||||
<meta property="article:section" content="{{ . }}">
|
||||
{{- end }}
|
||||
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
||||
{{- with .PublishDate }}
|
||||
<meta property="article:published_time" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
{{- with .Lastmod }}
|
||||
<meta property="article:modified_time" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
{{- range .GetTerms "tags" | first 6 }}
|
||||
<meta property="article:tag" content="{{ .Page.Title | plainify }}">
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:type" content="website">
|
||||
{{- end }}
|
||||
|
||||
{{- with partial "_funcs/get-page-images" . }}
|
||||
{{- range . | first 6 }}
|
||||
<meta property="og:image" content="{{ .Permalink }}">
|
||||
{{- end }}
|
||||
{{- range . | first 6 }}
|
||||
<meta property="og:image" content="{{ .Permalink }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Params.audio }}
|
||||
{{- range . | first 6 }}
|
||||
<meta property="og:audio" content="{{ . | absURL }}">
|
||||
{{- end }}
|
||||
{{- range . | first 6 }}
|
||||
<meta property="og:audio" content="{{ . | absURL }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Params.videos }}
|
||||
{{- range . | first 6 }}
|
||||
<meta property="og:video" content="{{ . | absURL }}">
|
||||
{{- end }}
|
||||
{{- range . | first 6 }}
|
||||
<meta property="og:video" content="{{ . | absURL }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- range .GetTerms "series" }}
|
||||
{{- range .Pages | first 7 }}
|
||||
{{- if ne $ . }}
|
||||
<meta property="og:see_also" content="{{ .Permalink }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range .Pages | first 7 }}
|
||||
{{- if ne $ . }}
|
||||
<meta property="og:see_also" content="{{ .Permalink }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with site.Params.social }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .facebook_app_id }}
|
||||
<meta property="fb:app_id" content="{{ . }}">
|
||||
{{- else }}
|
||||
{{- with .facebook_admin }}
|
||||
<meta property="fb:admins" content="{{ . }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .facebook_app_id }}
|
||||
<meta property="fb:app_id" content="{{ . }}">
|
||||
{{- else }}
|
||||
{{- with .facebook_admin }}
|
||||
<meta property="fb:admins" content="{{ . }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -7,148 +7,148 @@
|
||||
{{- $format := "default" }}
|
||||
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .page }}
|
||||
{{- $page = . }}
|
||||
{{- else }}
|
||||
{{- errorf $msg1 }}
|
||||
{{- end }}
|
||||
{{- with .format }}
|
||||
{{- $format = lower . }}
|
||||
{{- end }}
|
||||
{{- with .page }}
|
||||
{{- $page = . }}
|
||||
{{- else }}
|
||||
{{- errorf $msg1 }}
|
||||
{{- end }}
|
||||
{{- with .format }}
|
||||
{{- $format = lower . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if in $validFormats $format }}
|
||||
{{- if gt $page.Paginator.TotalPages 1 }}
|
||||
<ul class="pagination pagination-{{ $format }}">
|
||||
{{- partial (printf "inline/pagination/%s.html" $format) $page }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{- if gt $page.Paginator.TotalPages 1 }}
|
||||
<ul class="pagination pagination-{{ $format }}">
|
||||
{{- partial (printf "inline/pagination/%s.html" $format) $page }}
|
||||
</ul>
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- errorf $msg2 (delimit $validFormats ", ") }}
|
||||
{{- errorf $msg2 (delimit $validFormats ", ") }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Format: default
|
||||
{{/* --------------------------------------------------------------------- */}}
|
||||
{{- define "_partials/inline/pagination/default.html" }}
|
||||
{{- with .Paginator }}
|
||||
{{- $currentPageNumber := .PageNumber }}
|
||||
{{- with .Paginator }}
|
||||
{{- $currentPageNumber := .PageNumber }}
|
||||
|
||||
{{- with .First }}
|
||||
{{- if ne $currentPageNumber .PageNumber }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="First" class="page-link" role="button"><span aria-hidden="true">««</span></a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item disabled">
|
||||
<a aria-disabled="true" aria-label="First" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">««</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .First }}
|
||||
{{- if ne $currentPageNumber .PageNumber }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="First" class="page-link" role="button"><span aria-hidden="true">««</span></a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item disabled">
|
||||
<a aria-disabled="true" aria-label="First" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">««</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Prev }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Previous" class="page-link" role="button"><span aria-hidden="true">«</span></a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item disabled">
|
||||
<a aria-disabled="true" aria-label="Previous" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">«</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- with .Prev }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Previous" class="page-link" role="button"><span aria-hidden="true">«</span></a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item disabled">
|
||||
<a aria-disabled="true" aria-label="Previous" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">«</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
|
||||
{{- $slots := 5 }}
|
||||
{{- $start := math.Max 1 (sub .PageNumber (math.Floor (div $slots 2))) }}
|
||||
{{- $end := math.Min .TotalPages (sub (add $start $slots) 1) }}
|
||||
{{- if lt (add (sub $end $start) 1) $slots }}
|
||||
{{- $start = math.Max 1 (add (sub $end $slots) 1) }}
|
||||
{{- end }}
|
||||
{{- $slots := 5 }}
|
||||
{{- $start := math.Max 1 (sub .PageNumber (math.Floor (div $slots 2))) }}
|
||||
{{- $end := math.Min .TotalPages (sub (add $start $slots) 1) }}
|
||||
{{- if lt (add (sub $end $start) 1) $slots }}
|
||||
{{- $start = math.Max 1 (add (sub $end $slots) 1) }}
|
||||
{{- end }}
|
||||
|
||||
{{- range $k := seq $start $end }}
|
||||
{{- if eq $.Paginator.PageNumber $k }}
|
||||
<li class="page-item active">
|
||||
<a aria-current="page" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item">
|
||||
<a href="{{ (index $.Paginator.Pagers (sub $k 1)).URL }}" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $k := seq $start $end }}
|
||||
{{- if eq $.Paginator.PageNumber $k }}
|
||||
<li class="page-item active">
|
||||
<a aria-current="page" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item">
|
||||
<a href="{{ (index $.Paginator.Pagers (sub $k 1)).URL }}" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Next }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Next" class="page-link" role="button"><span aria-hidden="true">»</span></a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item disabled">
|
||||
<a aria-disabled="true" aria-label="Next" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">»</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- with .Next }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Next" class="page-link" role="button"><span aria-hidden="true">»</span></a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item disabled">
|
||||
<a aria-disabled="true" aria-label="Next" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">»</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
|
||||
{{- with .Last }}
|
||||
{{- if ne $currentPageNumber .PageNumber }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Last" class="page-link" role="button"><span aria-hidden="true">»»</span></a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item disabled">
|
||||
<a aria-disabled="true" aria-label="Last" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">»»</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Last }}
|
||||
{{- if ne $currentPageNumber .PageNumber }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Last" class="page-link" role="button"><span aria-hidden="true">»»</span></a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item disabled">
|
||||
<a aria-disabled="true" aria-label="Last" class="page-link" role="button" tabindex="-1"><span aria-hidden="true">»»</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Format: terse
|
||||
{{/* --------------------------------------------------------------------- */}}
|
||||
{{- define "_partials/inline/pagination/terse.html" }}
|
||||
{{- with .Paginator }}
|
||||
{{- $currentPageNumber := .PageNumber }}
|
||||
{{- with .Paginator }}
|
||||
{{- $currentPageNumber := .PageNumber }}
|
||||
|
||||
{{- with .First }}
|
||||
{{- if ne $currentPageNumber .PageNumber }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="First" class="page-link" role="button"><span aria-hidden="true">««</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .First }}
|
||||
{{- if ne $currentPageNumber .PageNumber }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="First" class="page-link" role="button"><span aria-hidden="true">««</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Prev }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Previous" class="page-link" role="button"><span aria-hidden="true">«</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- with .Prev }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Previous" class="page-link" role="button"><span aria-hidden="true">«</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
|
||||
{{- $slots := 3 }}
|
||||
{{- $start := math.Max 1 (sub .PageNumber (math.Floor (div $slots 2))) }}
|
||||
{{- $end := math.Min .TotalPages (sub (add $start $slots) 1) }}
|
||||
{{- if lt (add (sub $end $start) 1) $slots }}
|
||||
{{- $start = math.Max 1 (add (sub $end $slots) 1) }}
|
||||
{{- end }}
|
||||
{{- $slots := 3 }}
|
||||
{{- $start := math.Max 1 (sub .PageNumber (math.Floor (div $slots 2))) }}
|
||||
{{- $end := math.Min .TotalPages (sub (add $start $slots) 1) }}
|
||||
{{- if lt (add (sub $end $start) 1) $slots }}
|
||||
{{- $start = math.Max 1 (add (sub $end $slots) 1) }}
|
||||
{{- end }}
|
||||
|
||||
{{- range $k := seq $start $end }}
|
||||
{{- if eq $.Paginator.PageNumber $k }}
|
||||
<li class="page-item active">
|
||||
<a aria-current="page" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item">
|
||||
<a href="{{ (index $.Paginator.Pagers (sub $k 1)).URL }}" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range $k := seq $start $end }}
|
||||
{{- if eq $.Paginator.PageNumber $k }}
|
||||
<li class="page-item active">
|
||||
<a aria-current="page" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a>
|
||||
</li>
|
||||
{{- else }}
|
||||
<li class="page-item">
|
||||
<a href="{{ (index $.Paginator.Pagers (sub $k 1)).URL }}" aria-label="Page {{ $k }}" class="page-link" role="button">{{ $k }}</a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Next }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Next" class="page-link" role="button"><span aria-hidden="true">»</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- with .Next }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Next" class="page-link" role="button"><span aria-hidden="true">»</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
|
||||
{{- with .Last }}
|
||||
{{- if ne $currentPageNumber .PageNumber }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Last" class="page-link" role="button"><span aria-hidden="true">»»</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Last }}
|
||||
{{- if ne $currentPageNumber .PageNumber }}
|
||||
<li class="page-item">
|
||||
<a href="{{ .URL }}" aria-label="Last" class="page-link" role="button"><span aria-hidden="true">»»</span></a>
|
||||
</li>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
{{- with or .Title site.Title | plainify }}
|
||||
<meta itemprop="name" content="{{ . }}">
|
||||
<meta itemprop="name" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- with or .Description .Summary site.Params.description | plainify | htmlUnescape }}
|
||||
<meta itemprop="description" content="{{ trim . "\n\r\t " }}">
|
||||
<meta itemprop="description" content="{{ trim . "\n\r\t " }}">
|
||||
{{- end }}
|
||||
|
||||
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
|
||||
{{- with .PublishDate }}
|
||||
<meta itemprop="datePublished" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
<meta itemprop="datePublished" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
|
||||
{{- with .Lastmod }}
|
||||
<meta itemprop="dateModified" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
<meta itemprop="dateModified" {{ .Format $ISO8601 | printf "content=%q" | safeHTMLAttr }}>
|
||||
{{- end }}
|
||||
|
||||
{{- with .WordCount }}
|
||||
<meta itemprop="wordCount" content="{{ . }}">
|
||||
<meta itemprop="wordCount" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- $images := partial "_funcs/get-page-images" . }}
|
||||
{{- range first 6 $images }}
|
||||
<meta itemprop="image" content="{{ .Permalink }}">
|
||||
<meta itemprop="image" content="{{ .Permalink }}">
|
||||
{{- end }}
|
||||
|
||||
{{- /*
|
||||
@@ -35,22 +35,22 @@ Keywords precedence:
|
||||
*/}}
|
||||
{{- $keywords := slice }}
|
||||
{{- range .GetTerms "keywords" }}
|
||||
{{- $keywords = $keywords | append .Title }}
|
||||
{{- $keywords = $keywords | append .Title }}
|
||||
{{- else }}
|
||||
{{- with .Keywords }}
|
||||
{{- $keywords = . }}
|
||||
{{- else }}
|
||||
{{- range .GetTerms "tags" }}
|
||||
{{- $keywords = $keywords | append .Title }}
|
||||
{{- else }}
|
||||
{{- range $taxonomy, $_ := site.Taxonomies }}
|
||||
{{- range $.GetTerms $taxonomy }}
|
||||
{{- $keywords = $keywords | append .Title }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Keywords }}
|
||||
{{- $keywords = . }}
|
||||
{{- else }}
|
||||
{{- range .GetTerms "tags" }}
|
||||
{{- $keywords = $keywords | append .Title }}
|
||||
{{- else }}
|
||||
{{- range $taxonomy, $_ := site.Taxonomies }}
|
||||
{{- range $.GetTerms $taxonomy }}
|
||||
{{- $keywords = $keywords | append .Title }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with $keywords }}
|
||||
<meta itemprop="keywords" content="{{ delimit . `,` }}">
|
||||
<meta itemprop="keywords" content="{{ delimit . `,` }}">
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
{{- $images := partial "_funcs/get-page-images" . }}
|
||||
{{- with index $images 0 }}
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:image" content="{{ .Permalink }}">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:image" content="{{ .Permalink }}">
|
||||
{{- else }}
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:card" content="summary">
|
||||
{{- end }}
|
||||
|
||||
{{- with or .Title site.Title site.Params.title | plainify }}
|
||||
<meta name="twitter:title" content="{{ . }}">
|
||||
<meta name="twitter:title" content="{{ . }}">
|
||||
{{- end }}
|
||||
|
||||
{{- with or .Description .Summary site.Params.description | plainify | htmlUnescape }}
|
||||
<meta name="twitter:description" content="{{ trim . "\n\r\t " }}">
|
||||
<meta name="twitter:description" content="{{ trim . "\n\r\t " }}">
|
||||
{{- end }}
|
||||
|
||||
{{- $twitterSite := "" }}
|
||||
{{- with site.Params.social }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .twitter }}
|
||||
{{- $content := . }}
|
||||
{{- if not (strings.HasPrefix . "@") }}
|
||||
{{- $content = printf "@%v" . }}
|
||||
{{- end }}
|
||||
<meta name="twitter:site" content="{{ $content }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .twitter }}
|
||||
{{- $content := . }}
|
||||
{{- if not (strings.HasPrefix . "@") }}
|
||||
{{- $content = printf "@%v" . }}
|
||||
{{- end }}
|
||||
<meta name="twitter:site" content="{{ $content }}">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="no-js" lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Hugo Server: Error</title>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Hugo Server: Error</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-family: "Muli", system-ui, -apple-system, "Segoe UI", Roboto,
|
||||
@@ -58,30 +58,30 @@
|
||||
color: #ccc;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
{{ $codeStyle := "dracula" }}
|
||||
<div class="error">
|
||||
{{ highlight .Error "apl" (printf "linenos=false,noclasses=true,style=%s" $codeStyle ) }}
|
||||
</div>
|
||||
<hr>
|
||||
{{ range $i, $e := .Files }}
|
||||
{{ if not .ErrorContext }}
|
||||
{{ continue }}
|
||||
{{ end }}
|
||||
{{ $params := printf "noclasses=true,style=%s,linenos=table,hl_lines=%d,linenostart=%d" $codeStyle (add .ErrorContext.LinesPos 1) (sub .Position.LineNumber .ErrorContext.LinesPos) }}
|
||||
{{ $lexer := .ErrorContext.ChromaLexer | default "go-html-template" }}
|
||||
{{ with .Position }}
|
||||
<code class="filename"
|
||||
>{{ printf "%s:%d:%d" .Filename .LineNumber .ColumnNumber }}:</code
|
||||
>
|
||||
{{ end }}
|
||||
{{ highlight (delimit .ErrorContext.Lines "\n") $lexer $params }}
|
||||
<hr>
|
||||
{{ end }}
|
||||
<p class="version">{{ .Version }}</p>
|
||||
<a href="">Reload Page</a>
|
||||
</main>
|
||||
</body>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
{{ $codeStyle := "dracula" }}
|
||||
<div class="error">
|
||||
{{ highlight .Error "apl" (printf "linenos=false,noclasses=true,style=%s" $codeStyle) }}
|
||||
</div>
|
||||
<hr>
|
||||
{{ range $i, $e := .Files }}
|
||||
{{ if not .ErrorContext }}
|
||||
{{ continue }}
|
||||
{{ end }}
|
||||
{{ $params := printf "noclasses=true,style=%s,linenos=table,hl_lines=%d,linenostart=%d" $codeStyle (add .ErrorContext.LinesPos 1) (sub .Position.LineNumber .ErrorContext.LinesPos) }}
|
||||
{{ $lexer := .ErrorContext.ChromaLexer | default "go-html-template" }}
|
||||
{{ with .Position }}
|
||||
<code class="filename"
|
||||
>{{ printf "%s:%d:%d" .Filename .LineNumber .ColumnNumber }}:</code
|
||||
>
|
||||
{{ end }}
|
||||
{{ highlight (delimit .ErrorContext.Lines "\n") $lexer $params }}
|
||||
<hr>
|
||||
{{ end }}
|
||||
<p class="version">{{ .Version }}</p>
|
||||
<a href="">Reload Page</a>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{{ 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 -}}
|
||||
{{/* Only include once */}}
|
||||
{{- .Page.Scratch.Set "__h_simple_css" true -}}
|
||||
<style>
|
||||
.__h_video {
|
||||
position: relative;
|
||||
|
||||
@@ -58,18 +58,17 @@ Renders an HTML details element.
|
||||
{{- $title := or (.Get "title") "" }}
|
||||
{{- $open := false }}
|
||||
{{- if in (slice "false" false 0) (.Get "open") }}
|
||||
{{- $open = false }}
|
||||
{{- $open = false }}
|
||||
{{- else if in (slice "true" true 1) (.Get "open") }}
|
||||
{{- $open = true }}
|
||||
{{- $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") -}}
|
||||
{{- 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>
|
||||
|
||||
@@ -1,38 +1,34 @@
|
||||
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
|
||||
{{- if .Get "link" -}}
|
||||
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
|
||||
{{- 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 -}}
|
||||
{{- $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 }}
|
||||
<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>
|
||||
|
||||
@@ -1,244 +1,245 @@
|
||||
{{- $pc := site.Config.Privacy.Instagram -}}
|
||||
{{- if not $pc.Disable -}}
|
||||
{{- with .Get 0 -}}
|
||||
{{- template "render-instagram" (dict "id" . "pc" $pc) -}}
|
||||
{{- else -}}
|
||||
{{- errorf "The %q shortcode requires a single positional parameter, the ID of the Instagram post. See %s" .Name .Position -}}
|
||||
{{- end -}}
|
||||
{{- with .Get 0 -}}
|
||||
{{- template "render-instagram" (dict "id" . "pc" $pc) -}}
|
||||
{{- else -}}
|
||||
{{- errorf "The %q shortcode 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 -}}
|
||||
<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 -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{{- $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 -}}
|
||||
{{- with ($.Page.Param .) }}{{ . }}{{ else }}{{ errorf "Param %q not found: %s" $name $.Position }}{{ end -}}
|
||||
{{- else }}{{ errorf "Missing param key: %s" $.Position }}
|
||||
{{ end -}}
|
||||
@@ -50,30 +50,28 @@ Encodes the given text into a QR code using the specified options and renders th
|
||||
{{- $loading := or (.Get "loading") "" }}
|
||||
|
||||
{{- /* Validate arguments. */}}
|
||||
{{- $errors := false}}
|
||||
{{- $errors := false }}
|
||||
{{- if not $text }}
|
||||
{{- errorf "The %q shortcode requires a %q argument. See %s" .Name "text" .Position }}
|
||||
{{- $errors = true }}
|
||||
{{- 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 }}
|
||||
{{- 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 }}
|
||||
{{- 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 }}
|
||||
{{- $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 -}}
|
||||
|
||||
@@ -17,51 +17,51 @@ title, then loading.
|
||||
*/}}
|
||||
{{- $pc := site.Config.Privacy.Vimeo }}
|
||||
{{- if not $pc.Disable }}
|
||||
{{- if $pc.Simple }}
|
||||
{{- template "_shortcodes/vimeo_simple.html" . }}
|
||||
{{- else }}
|
||||
{{- $dnt := cond $pc.EnableDNT 1 0 }}
|
||||
{{- if $pc.Simple }}
|
||||
{{- template "_shortcodes/vimeo_simple.html" . }}
|
||||
{{- else }}
|
||||
{{- $dnt := cond $pc.EnableDNT 1 0 }}
|
||||
|
||||
{{- $allowFullScreen := true }}
|
||||
{{- $class := or (.Get "class") }}
|
||||
{{- $id := or (.Get "id") (.Get 0) }}
|
||||
{{- $loading := or (.Get "loading") }}
|
||||
{{- $title := or (.Get "title") }}
|
||||
{{- $allowFullScreen := true }}
|
||||
{{- $class := or (.Get "class") }}
|
||||
{{- $id := or (.Get "id") (.Get 0) }}
|
||||
{{- $loading := or (.Get "loading") }}
|
||||
{{- $title := or (.Get "title") }}
|
||||
|
||||
{{- if in (slice "true" true 1) (.Get "allowFullScreen") }}
|
||||
{{- $allowFullScreen = true }}
|
||||
{{- else if in (slice "false" false 0) (.Get "allowFullScreen") }}
|
||||
{{- $allowFullScreen = false }}
|
||||
{{- end }}
|
||||
{{- if in (slice "true" true 1) (.Get "allowFullScreen") }}
|
||||
{{- $allowFullScreen = true }}
|
||||
{{- else if in (slice "false" false 0) (.Get "allowFullScreen") }}
|
||||
{{- $allowFullScreen = false }}
|
||||
{{- end }}
|
||||
|
||||
{{- $iframeAllowList := "" }}
|
||||
{{- if $allowFullScreen }}
|
||||
{{- $iframeAllowList = "fullscreen" }}
|
||||
{{- 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;" }}
|
||||
{{- $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 }}
|
||||
{{- 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 }}
|
||||
|
||||
@@ -1,52 +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 shortcode 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 shortcode requires a single positional parameter, the ID of the Vimeo video. See %s" .Name .Position -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $ctx := dict "ctx" . }}
|
||||
{{- if .IsNamedParams -}}
|
||||
{{- with .Get "id" -}}
|
||||
{{- $ctx = merge $ctx (dict "id" . "class" ($.Get "class")) -}}
|
||||
{{- template "render-vimeo" $ctx -}}
|
||||
{{- else -}}
|
||||
{{- errorf "The %q shortcode 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 shortcode 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 -}}
|
||||
{{- warnidf "shortcode-vimeo-simple" "The %q shortcode was unable to retrieve the remote data: %s. See %s" $.ctx.Name . $.ctx.Position -}}
|
||||
{{- 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 | string }}" 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 -}}
|
||||
{{- $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 -}}
|
||||
{{- warnidf "shortcode-vimeo-simple" "The %q shortcode was unable to retrieve the remote data: %s. See %s" $.ctx.Name . $.ctx.Position -}}
|
||||
{{- 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 | string }}" 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 -}}
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
{{- $pc := site.Config.Privacy.X -}}
|
||||
{{- if not $pc.Disable -}}
|
||||
{{- if $pc.Simple -}}
|
||||
{{- template "_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 -}}
|
||||
{{- if $pc.Simple -}}
|
||||
{{- template "_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 -}}
|
||||
{{- warnidf "shortcode-x-getremote" "The %q shortcode was unable to retrieve the remote data: %s. See %s" $.ctx.Name . $.ctx.Position -}}
|
||||
{{- 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 -}}
|
||||
{{- $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 -}}
|
||||
{{- warnidf "shortcode-x-getremote" "The %q shortcode was unable to retrieve the remote data: %s. See %s" $.ctx.Name . $.ctx.Position -}}
|
||||
{{- 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 -}}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
{{- 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 -}}
|
||||
{{- $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 -}}
|
||||
{{- warnidf "shortcode-x-simple-getremote" "The %q shortcode was unable to retrieve the remote data: %s. See %s" $.ctx.Name . $.ctx.Position -}}
|
||||
{{- 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 -}}
|
||||
{{- $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 -}}
|
||||
{{- warnidf "shortcode-x-simple-getremote" "The %q shortcode was unable to retrieve the remote data: %s. See %s" $.ctx.Name . $.ctx.Position -}}
|
||||
{{- 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 -}}
|
||||
{{- 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:
|
||||
@@ -56,5 +56,5 @@
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -24,104 +24,102 @@ Renders an embedded YouTube video.
|
||||
{{- $pc := .Page.Site.Config.Privacy.YouTube }}
|
||||
{{- $remoteErrID := "err-youtube-remote" }}
|
||||
{{- if not $pc.Disable }}
|
||||
{{- with $id := or (.Get "id") (.Get 0) }}
|
||||
{{- 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" }}
|
||||
{{- /* 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") }}
|
||||
{{- $allowFullScreen = true }}
|
||||
{{- else if in (slice "false" false 0) ($.Get "allowFullScreen") }}
|
||||
{{- $allowFullScreen = false }}
|
||||
{{- end }}
|
||||
{{- if in (slice "true" true 1) ($.Get "autoplay") }}
|
||||
{{- $autoplay = 1 }}
|
||||
{{- else if in (slice "false" false 0) ($.Get "autoplay") }}
|
||||
{{- $autoplay = 0 }}
|
||||
{{- end }}
|
||||
{{- if in (slice "true" true 1) ($.Get "controls") }}
|
||||
{{- $controls = 1 }}
|
||||
{{- else if in (slice "false" false 0) ($.Get "controls") }}
|
||||
{{- $controls = 0 }}
|
||||
{{- end }}
|
||||
{{- if in (slice "true" true 1) ($.Get "loop") }}
|
||||
{{- $loop = 1 }}
|
||||
{{- else if in (slice "false" false 0) ($.Get "loop") }}
|
||||
{{- $loop = 0 }}
|
||||
{{- end }}
|
||||
{{- if or (in (slice "true" true 1) ($.Get "mute")) $autoplay }}
|
||||
{{- $mute = 1 }}
|
||||
{{- else if in (slice "false" false 0) ($.Get "mute") }}
|
||||
{{- $mute = 0 }}
|
||||
{{- 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 }}
|
||||
{{- /* Get arguments. */}}
|
||||
{{- if in (slice "true" true 1) ($.Get "allowFullScreen") }}
|
||||
{{- $allowFullScreen = true }}
|
||||
{{- else if in (slice "false" false 0) ($.Get "allowFullScreen") }}
|
||||
{{- $allowFullScreen = false }}
|
||||
{{- end }}
|
||||
{{- if in (slice "true" true 1) ($.Get "autoplay") }}
|
||||
{{- $autoplay = 1 }}
|
||||
{{- else if in (slice "false" false 0) ($.Get "autoplay") }}
|
||||
{{- $autoplay = 0 }}
|
||||
{{- end }}
|
||||
{{- if in (slice "true" true 1) ($.Get "controls") }}
|
||||
{{- $controls = 1 }}
|
||||
{{- else if in (slice "false" false 0) ($.Get "controls") }}
|
||||
{{- $controls = 0 }}
|
||||
{{- end }}
|
||||
{{- if in (slice "true" true 1) ($.Get "loop") }}
|
||||
{{- $loop = 1 }}
|
||||
{{- else if in (slice "false" false 0) ($.Get "loop") }}
|
||||
{{- $loop = 0 }}
|
||||
{{- end }}
|
||||
{{- if or (in (slice "true" true 1) ($.Get "mute")) $autoplay }}
|
||||
{{- $mute = 1 }}
|
||||
{{- else if in (slice "false" false 0) ($.Get "mute") }}
|
||||
{{- $mute = 0 }}
|
||||
{{- 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 }}
|
||||
|
||||
{{- /* Adjust iframeAllowList. */}}
|
||||
{{- if $allowFullScreen }}
|
||||
{{- $iframeAllowList = printf "%s; fullscreen" $iframeAllowList }}
|
||||
{{- end }}
|
||||
{{- /* Adjust iframeAllowList. */}}
|
||||
{{- if $allowFullScreen }}
|
||||
{{- $iframeAllowList = printf "%s; fullscreen" $iframeAllowList }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* 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 }}
|
||||
{{- /* 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 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" }}
|
||||
{{- /* 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 }}
|
||||
{{- /* 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 }}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ site.Language.Locale }}">
|
||||
<head>
|
||||
<title>{{ .Permalink }}</title>
|
||||
{{ with .OutputFormats.Canonical }}<link rel="{{ .Rel }}" href="{{ .Permalink }}">{{ end }}
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="0; url={{ .Permalink }}">
|
||||
</head>
|
||||
<head>
|
||||
<title>{{ .Permalink }}</title>
|
||||
{{ with .OutputFormats.Canonical }}<link rel="{{ .Rel }}" href="{{ .Permalink }}">{{ end }}
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="refresh" content="0; url={{ .Permalink }}">
|
||||
</head>
|
||||
</html>
|
||||
|
||||
@@ -1,59 +1,67 @@
|
||||
{{- $authorEmail := "" }}
|
||||
{{- with site.Params.author }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .email }}
|
||||
{{- $authorEmail = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .email }}
|
||||
{{- $authorEmail = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- $authorName := "" }}
|
||||
{{- with site.Params.author }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .name }}
|
||||
{{- $authorName = . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $authorName = . }}
|
||||
{{- end }}
|
||||
{{- if reflect.IsMap . }}
|
||||
{{- with .name }}
|
||||
{{- $authorName = . }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
{{- $authorName = . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- $pctx := . }}
|
||||
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
|
||||
{{- $pages := slice }}
|
||||
{{- if or $.IsHome $.IsSection }}
|
||||
{{- $pages = $pctx.RegularPages }}
|
||||
{{- $pages = $pctx.RegularPages }}
|
||||
{{- else }}
|
||||
{{- $pages = $pctx.Pages }}
|
||||
{{- $pages = $pctx.Pages }}
|
||||
{{- end }}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit }}
|
||||
{{- if ge $limit 1 }}
|
||||
{{- $pages = $pages | first $limit }}
|
||||
{{- $pages = $pages | first $limit }}
|
||||
{{- end }}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||
<channel>
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>
|
||||
<generator>Hugo</generator>
|
||||
<language>{{ site.Language.Locale }}</language>{{ with $authorEmail }}
|
||||
<managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
|
||||
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
|
||||
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
|
||||
{{- with .OutputFormats.Get "RSS" }}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{- end }}
|
||||
{{- range $pages }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>
|
||||
</item>
|
||||
{{- end }}
|
||||
</channel>
|
||||
<channel>
|
||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>
|
||||
<generator>Hugo</generator>
|
||||
<language>{{ site.Language.Locale }}</language>
|
||||
{{ with $authorEmail }}
|
||||
<managingEditor>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>
|
||||
{{ end }}
|
||||
{{ with $authorEmail }}
|
||||
<webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>
|
||||
{{ end }}
|
||||
{{ with .Site.Copyright }}
|
||||
<copyright>{{ . }}</copyright>
|
||||
{{ end }}
|
||||
{{ if not .Date.IsZero }}
|
||||
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
|
||||
{{ end }}
|
||||
{{- with .OutputFormats.Get "RSS" }}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{- end }}
|
||||
{{- range $pages }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
|
||||
<guid>{{ .Permalink }}</guid>
|
||||
<description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>
|
||||
</item>
|
||||
{{- end }}
|
||||
</channel>
|
||||
</rss>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{{/* gotmplfmt-ignore-all */}}
|
||||
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
{{ range . }}
|
||||
<sitemap>
|
||||
<loc>{{ .SitemapAbsURL }}</loc>
|
||||
{{ if not .Lastmod.IsZero }}
|
||||
<lastmod>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod>
|
||||
{{ end }}
|
||||
</sitemap>
|
||||
{{ end }}
|
||||
{{ range . }}
|
||||
<sitemap>
|
||||
<loc>{{ .SitemapAbsURL }}</loc>
|
||||
{{ if not .Lastmod.IsZero }}
|
||||
<lastmod>{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}</lastmod>
|
||||
{{ end }}
|
||||
</sitemap>
|
||||
{{ end }}
|
||||
</sitemapindex>
|
||||
|
||||
@@ -122,7 +122,7 @@ Content: {{ .Content }}
|
||||
`
|
||||
|
||||
b := hugolib.Test(t, files)
|
||||
b.AssertFileContent("public/index.html", "35b077dcb9887a84")
|
||||
b.AssertFileContent("public/index.html", "c18e12c59a2f9bdb")
|
||||
}
|
||||
|
||||
func TestHighlightShortcode(t *testing.T) {
|
||||
@@ -237,12 +237,12 @@ Content: {{ .Content }}
|
||||
|
||||
// Regular mode
|
||||
b := hugolib.Test(t, files)
|
||||
b.AssertFileContent("public/index.html", "6e93404b93277876")
|
||||
b.AssertFileContent("public/index.html", "336bb64b13c24575")
|
||||
|
||||
// Simple mode
|
||||
files = strings.ReplaceAll(files, "privacy.instagram.simple = false", "privacy.instagram.simple = true")
|
||||
b = hugolib.Test(t, files)
|
||||
b.AssertFileContent("public/index.html", "2c1dce3881be0513")
|
||||
b.AssertFileContent("public/index.html", "4c094707f37b2340")
|
||||
}
|
||||
|
||||
func TestParamShortcode(t *testing.T) {
|
||||
@@ -469,14 +469,14 @@ Content: {{ .Content }}
|
||||
|
||||
// Regular mode
|
||||
b := hugolib.Test(t, files)
|
||||
b.AssertFileContent("public/p1/index.html", "31c54d7f8c54f73d")
|
||||
b.AssertFileContent("public/p2/index.html", "31c54d7f8c54f73d")
|
||||
b.AssertFileContent("public/p3/index.html", "7c073565f380599b")
|
||||
b.AssertFileContent("public/p1/index.html", "2144844b57ee39d8")
|
||||
b.AssertFileContent("public/p2/index.html", "2144844b57ee39d8")
|
||||
b.AssertFileContent("public/p3/index.html", "a131e93ce53bc318")
|
||||
|
||||
// Simple mode
|
||||
files = strings.ReplaceAll(files, "privacy.vimeo.simple = false", "privacy.vimeo.simple = true")
|
||||
b = hugolib.Test(t, files)
|
||||
b.AssertFileContent("public/p1/index.html", "fb22905d5b100a5a")
|
||||
b.AssertFileContent("public/p1/index.html", "582bde2225dc43c0")
|
||||
|
||||
// Simple mode with non-existent id
|
||||
files = strings.ReplaceAll(files, "{{< vimeo 19899678 >}}", "{{< vimeo __id_does_not_exist__ >}}")
|
||||
@@ -587,14 +587,14 @@ title: p2
|
||||
|
||||
b := hugolib.Test(t, files)
|
||||
|
||||
b.AssertFileContent("public/p1/index.html", "4b54bf9bd03946ec")
|
||||
b.AssertFileContent("public/p2/index.html", "289c655e727e596c")
|
||||
b.AssertFileContent("public/p1/index.html", "365fe481b0377cd9")
|
||||
b.AssertFileContent("public/p2/index.html", "82d7f05fb1fefb3b")
|
||||
|
||||
files = strings.ReplaceAll(files, "privacy.youtube.privacyEnhanced = false", "privacy.youtube.privacyEnhanced = true")
|
||||
|
||||
b = hugolib.Test(t, files)
|
||||
b.AssertFileContent("public/p1/index.html", "78eb19b5c6f3768f")
|
||||
b.AssertFileContent("public/p2/index.html", "a6db910a9cf54bc1")
|
||||
b.AssertFileContent("public/p1/index.html", "48398992f5ff0afc")
|
||||
b.AssertFileContent("public/p2/index.html", "116436ffc3f62191")
|
||||
}
|
||||
|
||||
func TestShortcodePlainTextVsHTMLTemplateIssue13698(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user