use partial for footer scripts
This commit is contained in:
parent
7f421830c5
commit
ed9e769b2d
5 changed files with 125 additions and 78 deletions
46
layouts/partials/single/footer-scripts.html
Normal file
46
layouts/partials/single/footer-scripts.html
Normal file
|
@ -0,0 +1,46 @@
|
|||
{{- /*
|
||||
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 }}
|
||||
{{-
|
||||
partialCached
|
||||
"scripts/show_post_locations_on_map.html"
|
||||
( dict
|
||||
"pc" .pc
|
||||
"locations_data" .sc.Site.Data.locations
|
||||
"locations" .pc.Params.locations
|
||||
)
|
||||
.pc.Params.locations
|
||||
-}}
|
||||
{{ end }}
|
||||
|
||||
{{ if .pc.HasShortcode "chart" }}
|
||||
{{- $configJs := ( .pc.Page.Resources.GetMatch "charts-init" | fingerprint ) -}}
|
||||
{{-
|
||||
partialCached
|
||||
"scripts/charts.html"
|
||||
$configJs
|
||||
$configJs
|
||||
-}}
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue