mirror of
https://github.com/gethinode/hinode.git
synced 2025-10-15 05:53:09 +00:00
103 lines
4.3 KiB
HTML
103 lines
4.3 KiB
HTML
{{- define "partials/optional-scripts.html" -}}
|
|
{{ $page_modules := slice }}
|
|
{{ if reflect.IsMap .Params.modules }}
|
|
{{ $page_modules = .Params.modules }}
|
|
{{ else }}
|
|
{{ $page_modules = $page_modules | append .Params.modules }}
|
|
{{ end }}
|
|
|
|
{{- $modules := site.Params.modules.optional | intersect $page_modules -}}
|
|
{{- range $index, $mod := $modules -}}
|
|
{{- $filename := printf "js/%s.bundle.js" $mod -}}
|
|
{{- $match := printf "js/modules/%s/**.js" $mod -}}
|
|
{{- $skipTemplate := false -}}
|
|
{{- if reflect.IsSlice site.Params.modules.disableTemplate -}}
|
|
{{- if in site.Params.modules.disableTemplate $mod}}
|
|
{{- $skipTemplate = true -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{ $state := "" }}
|
|
{{- with (index site.Params.modules $mod) -}}
|
|
{{- with index . "state" }}{{ $state = . }}{{ end -}}
|
|
{{- end -}}
|
|
|
|
{{- partial "footer/scripts.html" (dict "filename" $filename "match" $match "header" false "skipTemplate" $skipTemplate "state" $state "page" .) }}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Set version-aware sidebar menu */ -}}
|
|
{{- $version := partial "utilities/GetVersion.html" (dict "page" . "base" true) -}}
|
|
{{- $.Scratch.Set "version" $version -}}
|
|
{{ with partial "utilities/GetMenu" (dict "page" . "version" $version) }}{{ $.Scratch.Set "sidebar" . }}{{ end }}
|
|
|
|
{{- /* Validate if current version is latest */ -}}
|
|
{{- if and site.Params.docs.checkVersion $version -}}
|
|
{{- if ne $version "latest" -}}
|
|
{{- if partial "utilities/IsOlder" (dict "current" $version) -}}
|
|
{{- $.Scratch.Set "pageAlertMsg" (T "newerVersionAlert" site.Title) -}}
|
|
{{- $.Scratch.Set "pageAlertURL" (or site.Params.docs.latestURL site.baseURL) -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
|
|
{{- /* Validate module configuration */ -}}
|
|
{{- if and .IsPage (not (in .Site.Params.modules.core "bootstrap")) -}}
|
|
{{- errorf "Bootstrap is a required module, please add it to 'modules.core' in your site parameters" -}}
|
|
{{- end -}}
|
|
|
|
{{- $fullCover := or (or (and .IsHome .Site.Params.home.fullCover) .Page.Params.fullCover) .Site.Params.main.footerBelowFold }}
|
|
{{- $.Scratch.Set "fullCover" $fullCover -}}
|
|
|
|
{{- /* Define section headings */ -}}
|
|
{{- $loading := "" -}}
|
|
{{- if $fullCover }}{{ $loading = .Site.Params.main.loading }}{{ end -}}
|
|
{{ $sections := partial "utilities/GetSections.html" (dict "page" . "loading" $loading) }}
|
|
{{- $.Scratch.Set "sections" $sections -}}
|
|
|
|
{{- /* Define main breakpoint */ -}}
|
|
{{- $.Scratch.Set "breakpoint" (partial "utilities/GetBreakpoint.html") }}
|
|
|
|
<!doctype html>
|
|
<html lang="{{ .Site.Language.Lang }}" class="no-js">
|
|
<head>
|
|
{{ block "head" . }}{{ end -}}
|
|
</head>
|
|
|
|
<body>
|
|
{{- partial "footer/scripts.html" (dict "filename" "js/critical.bundle.js" "match" "js/critical/**.js" "header" true "page" .) -}}
|
|
<div class="d-flex flex-column min-vh-100">
|
|
<div class="d-flex flex-column {{ if $fullCover }} fullscreen{{ end }}{{ if .IsHome }} {{ .Site.Params.home.style }}{{ end }}">
|
|
{{- partial "assets/navbar.html" (dict
|
|
"page" .
|
|
"fixed" (string site.Params.navigation.fixed)
|
|
"color" site.Params.navigation.color
|
|
"style" (default "light" site.Params.navigation.style)
|
|
"size" (default "md" site.Params.navigation.size))
|
|
-}}
|
|
<div class="main-content">
|
|
{{ block "featured" . }}{{ end -}}
|
|
</div>
|
|
{{ if .Site.Params.main.footerBelowFold }}
|
|
{{ block "main" . }}{{ end -}}
|
|
{{ end }}
|
|
</div>
|
|
|
|
{{ if not .Site.Params.main.footerBelowFold }}
|
|
{{ block "main" . }}{{ end -}}
|
|
{{- partial "footer/social.html" . -}}
|
|
{{- partial "footer/footer.html" . -}}
|
|
{{ end }}
|
|
</div>
|
|
|
|
{{ if .Site.Params.main.footerBelowFold }}
|
|
{{- partial "footer/social.html" . -}}
|
|
{{- partial "footer/footer.html" . -}}
|
|
{{ end }}
|
|
|
|
{{- partial "footer/toast-container.html" . -}}
|
|
{{- partialCached "footer/scripts.html" (dict "header" false "page" . "core" true) }}
|
|
{{- partial "partials/optional-scripts.html" . -}}
|
|
</body>
|
|
</html>
|