diff options
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/_default/baseof.html | 80 | ||||
| -rw-r--r-- | layouts/_default/single.html | 47 | ||||
| -rw-r--r-- | layouts/partials/disqus.html | 24 |
3 files changed, 151 insertions, 0 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..ebf732c --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,80 @@ +{{- /* 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 -}} + +{{- /* Initialize module configuration */ -}} +{{- $modules := partialCached "utilities/InitModules.html" . -}} +{{- $.Scratch.Set "modules" $modules -}} + +{{- $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" (partialCached "utilities/GetBreakpoint.html" .) }} + +{{- /* Define base URL */ -}} +{{ $lang := site.LanguageCode | default site.Language.Lang }} +{{ $.Scratch.Set "baseURL" (strings.TrimSuffix (printf "%s/" $lang) site.Home.RelPermalink) }} + +<!doctype html> +<html lang="{{ .Site.Language.Lang }}" class="no-js"> + <head> + {{- partial "footer/scripts.html" (dict "page" . "type" "critical") -}} + {{ block "head" . }}{{ end -}} + </head> + + <body> + <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" site.Params.navigation.fixed + "overlay" site.Params.navigation.overlay + "overlayMode" site.Params.navigation.overlayMode + "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/popup.html" . -}} + {{- partial "footer/toast-container.html" . -}} + {{- partial "assets/symbols.html" . -}} + {{- partialCached "footer/scripts.html" (dict "page" .) -}} + {{- partial "footer/scripts.html" (dict "page" . "type" "optional") -}} + </body> +</html> diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..f14768d --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,47 @@ +{{ define "main" -}} + {{- $breakpoint := $.Scratch.Get "breakpoint" -}} + {{- $hasSidebar := .Site.Params.navigation.sidebar | default true -}} + {{ $sidebar := "" }} + {{ if $hasSidebar }}{{ $sidebar = .Render "single/sidebar" }}{{ end }} + {{ $toc := .Render "single/panel-toc" }} + + {{ with $sidebar }} + <div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvass-sidebar" aria-labelledby="offcanvas-label"> + <div class="offcanvas-header"> + <h5 class="offcanvas-title" id="offcanvas-label">{{ strings.FirstUpper $.Section }}</h5> + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="{{ T "close" }}"></button> + </div> + <div class="offcanvas-body"> + {{ . | safeHTML }} + </div> + </div> + {{ end }} + + <div class="container-xxl flex-fill p-4 px-xxl-0"> + {{ if $hasSidebar -}} + <div class="row row-cols-1 row-cols-{{ $breakpoint.current }}-2 row-cols-{{ $breakpoint.next }}-3"> + <div class="col col-{{ $breakpoint.next }}-2 d-none d-{{ $breakpoint.next }}-block sidebar-overflow sticky-top pt-5"> + {{ $sidebar | safeHTML }} + </div> + <div class="col-12 col-{{ $breakpoint.current }}-9 col-{{ $breakpoint.next }}-8 mb-5 p-4"> + {{ .Render "single/main" }} + </div> + <div class="col col-{{ $breakpoint.current }}-3 col-{{ $breakpoint.next }}-2 d-none d-{{ $breakpoint.current }}-block pt-5"> + {{ $toc | safeHTML }} + </div> + </div> + {{ else }} + <div class="row row-cols-1 row-cols-{{ $breakpoint.current }}-2"> + <div class="col col-{{ $breakpoint.prev }}-12 col-{{ $breakpoint.current }}-9"> + {{ .Render "single/main" }} + </div> + <div class="col col-{{ $breakpoint.current }}-3 d-none d-{{ $breakpoint.current }}-block"> + {{ $toc | safeHTML }} + </div> + </div> + {{ end -}} + <div> + {{ partial "disqus.html" . }} + </div> + </div> +{{ end -}}
\ No newline at end of file diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html new file mode 100644 index 0000000..8caab7b --- /dev/null +++ b/layouts/partials/disqus.html @@ -0,0 +1,24 @@ +{{- $pc := .Site.Config.Privacy.Disqus -}} +{{- if not $pc.Disable -}} +{{ if .Site.Config.Services.Disqus.Shortname }}<div id="disqus_thread"></div> +<script> + window.disqus_config = function () { + {{with .Params.disqus_identifier }}this.page.identifier = '{{ . }}';{{end}} + {{with .Params.disqus_title }}this.page.title = '{{ . }}';{{end}} + {{with .Params.disqus_url }}this.page.url = '{{ . | html }}';{{end}} + }; + (function() { + // if (["localhost", "127.0.0.1"].indexOf(window.location.hostname) != -1) { + // document.getElementById('disqus_thread').innerHTML = 'Disqus comments not available by default when the website is previewed locally.'; + // return; + // } + var d = document, s = d.createElement('script'); s.async = true; + s.src = '//' + {{ .Site.Config.Services.Disqus.Shortname }} + '.disqus.com/embed.js'; + console.log(s.src); + s.setAttribute('data-timestamp', +new Date()); + (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}} +{{- end -}}
\ No newline at end of file |
