refactor templates layout
@see https://gohugo.io/templates/new-templatesystem-overview/
This commit is contained in:
parent
a83f339dc8
commit
230c46411b
102 changed files with 2 additions and 2 deletions
56
layouts/_partials/single/footer-scripts.html
Normal file
56
layouts/_partials/single/footer-scripts.html
Normal file
|
@ -0,0 +1,56 @@
|
|||
{{- /*
|
||||
Renders a single item's required footer JS scripts.
|
||||
|
||||
@params sc Site context.
|
||||
@params pc Page context.
|
||||
*/
|
||||
-}}
|
||||
|
||||
|
||||
<!-- Validation -->
|
||||
|
||||
{{- if ( not ( isset . "sc" ) ) -}}
|
||||
{{- errorf "No site context passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( not ( isset . "pc" ) ) -}}
|
||||
{{- errorf "No page context passed" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if ( and ( .pc.HasShortcode "chart" ) ( not ( .pc.Page.Resources.GetMatch "charts-init" ) ) ) -}}
|
||||
{{- errorf "No 'chart-init' page resource defined (%q)" .pc.Page.File.Path -}}
|
||||
{{- end -}}
|
||||
|
||||
|
||||
<!-- Rendering -->
|
||||
|
||||
{{ if .pc.Params.locations }}
|
||||
<script>
|
||||
{{-
|
||||
(
|
||||
partialCached
|
||||
"scripts/show_post_locations_on_map.js"
|
||||
( dict
|
||||
"pc" .pc
|
||||
"locations_data" .sc.Site.Data.locations
|
||||
"locations" .pc.Params.locations
|
||||
)
|
||||
.pc.Params.locations
|
||||
) | safeJS
|
||||
-}}
|
||||
</script>
|
||||
{{ end }}
|
||||
|
||||
{{ if .pc.HasShortcode "chart" }}
|
||||
{{- $configJs := ( .pc.Page.Resources.GetMatch "charts-init" | fingerprint ) -}}
|
||||
<script>
|
||||
{{-
|
||||
(
|
||||
partialCached
|
||||
"scripts/charts.js"
|
||||
$configJs
|
||||
$configJs
|
||||
) | safeJS
|
||||
-}}
|
||||
</script>
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue