feat: improve configuration (#245)

* feat: improve configuration

* fix: fix partials/footer.html error
This commit is contained in:
Dillon
2020-04-21 22:55:06 +08:00
committed by GitHub
parent 8a0e61085c
commit f14301c395
62 changed files with 1548 additions and 1669 deletions

View File

@@ -1,15 +1,15 @@
{{- $scratch := .Page.Scratch.Get "scratch" -}}
{{- $mapbox := (.Page.Scratch.Get "params").page.mapbox | default dict -}}
{{- $lng := cond .IsNamedParams (.Get "lng") (.Get 0) -}}
{{- $lat := cond .IsNamedParams (.Get "lat") (.Get 1) -}}
{{- $zoom := cond .IsNamedParams (.Get "zoom") (.Get 2) | default 10 -}}
{{- $marked := cond .IsNamedParams (.Get "marked") (.Get 3) | ne false -}}
{{- $lightStyle := .Page.Params.mapbox.lightStyle | default .Page.Site.Params.mapbox.lightStyle -}}
{{- $darkStyle := .Page.Params.mapbox.darkStyle | default .Page.Site.Params.mapbox.darkStyle -}}
{{- $navigation := ne .Page.Params.mapbox.navigation false | and (ne .Page.Site.Params.mapbox.navigation false) -}}
{{- $geolocate := ne .Page.Params.mapbox.geolocate false | and (ne .Page.Site.Params.mapbox.geolocate false) -}}
{{- $scale := ne .Page.Params.mapbox.scale false | and (ne .Page.Site.Params.mapbox.scale false) -}}
{{- $fullscreen := ne .Page.Params.mapbox.fullscreen false | and (ne .Page.Site.Params.mapbox.fullscreen false) -}}
{{- $lightStyle := $mapbox.lightStyle -}}
{{- $darkStyle := $mapbox.darkStyle -}}
{{- $navigation := $mapbox.navigation -}}
{{- $geolocate := $mapbox.geolocate -}}
{{- $scale := $mapbox.scale -}}
{{- $fullscreen := $mapbox.fullscreen -}}
{{- $width := "100%" -}}
{{- $height := "20rem" -}}
@@ -28,6 +28,6 @@
{{- end -}}
{{- $darkStyle = $darkStyle | default $lightStyle -}}
{{- $options := dict "lng" $lng "lat" $lat "zoom" $zoom "marked" $marked "lightStyle" $lightStyle "darkStyle" $darkStyle "geolocate" $geolocate "navigation" $navigation "scale" $scale "fullscreen" $fullscreen -}}
{{- $id := partial "function/id.html" (dict "content" $options "scratch" $scratch) -}}
{{- $id := partial "function/id.html" (dict "content" $options "scratch" .Page.Scratch) -}}
<div class="mapbox" id="{{ $id }}" style="width: {{ $width }}; height: {{ $height }};"></div>
{{- $scratch.Set "mapbox" true -}}
{{- dict "mapbox" true | merge (.Page.Scratch.Get "this") | .Page.Scratch.Set "this" -}}