Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion exampleSite/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ defaultContentLanguage = 'en'
secondary_font = "Inter" # Default is System font
mono_font = "Fira Code" # Default is System font

[params.landingpage]
enabled = true # (optional) - Set to 'false' to disable the landing page (default is true)

[params.footer]
copyright = "© :YEAR: Lotus Labs. Built with [**Lotus Docs**](https://github.com/colinwilson/lotusdocs)"
# version = true # includes git commit info
Expand Down Expand Up @@ -173,4 +176,4 @@ defaultContentLanguage = 'en'
# name = "Community"
# url = "https://github.com/colinwilson/lotusdocs/discussions"
# identifier = "community"
# weight = 30
# weight = 30
46 changes: 22 additions & 24 deletions layouts/index.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
{{ define "main" }}
{{ $landingData := .Site.Data.landing }}
{{ $map := newScratch }}

{{ range $key, $value := $landingData }}
{{ $sectionTitle := (index $key) }}
{{ $weight := string ($value.weight) }}
{{ $template := string (replaceRE `( |-{1,})` "_" $value.template) }}
{{ with and $template $weight }}
{{ $map.SetInMap "wgtTpl" $sectionTitle (dict
"weight" $weight
"template" $template
"sectionTitle" $sectionTitle
)}}
{{ end }}
{{ end }}

{{ range sort ($map.Get "wgtTpl") ".weight" }}
{{ $.Scratch.Set "sectionTitle" .sectionTitle }}
{{ $path := printf "landing/%s.html" .template }}
{{ partial $path $.Page }}
{{ end }}
{{/* printf "%s" (sort ($map.Get "wgtTpl") ".weight" ) */}}
{{ end }}
{{- define "main" -}}
{{- $landingPageEnabled := .Site.Params.landingpage.enabled | default true -}}
{{- if not $landingPageEnabled -}}
<script>
window.location.href = "/docs/";
</script>
{{- else -}}
{{- $landingData := .Site.Data.landing -}}
{{- $sections := slice -}}
{{- range $sectionTitle, $value := $landingData -}}
{{- $weight := printf "%v" $value.weight -}}
{{- $template := replaceRE `( |-{1,})` "_" $value.template -}}
{{- $section := dict "sectionTitle" $sectionTitle "weight" $weight "template" $template -}}
{{- $sections = $sections | append $section -}}
{{- end -}}
{{- $sortedSections := sort $sections "weight" -}}
{{- range $sortedSections -}}
{{- $.Scratch.Set "sectionTitle" .sectionTitle -}}
{{- partial (printf "landing/%s.html" .template) $.Page -}}
{{- end -}}
{{- end -}}
{{- end -}}
Loading