forked from drowl87/hextra_mirror
feat: sidebar util to read data
This commit is contained in:
parent
6d4bbac085
commit
74fb165358
20
layouts/partials/components/sidebar/read-data.html
Normal file
20
layouts/partials/components/sidebar/read-data.html
Normal file
@ -0,0 +1,20 @@
|
||||
{{/*
|
||||
Get sidebar config from Hugo `data` directory
|
||||
|
||||
If the site is multilingual, the sidebar data is stored in a language-specific
|
||||
directory. For example, the English sidebar data is stored in `data/en/sidebar.yaml`.
|
||||
*/}}
|
||||
|
||||
{{ $data := "" }}
|
||||
|
||||
{{ if hugo.IsMultilingual }}
|
||||
{{ with (index site.Data site.Language.Lang "sidebar") }}
|
||||
{{ $data = . }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ with (index site.Data "sidebar") }}
|
||||
{{ $data = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $data }}
|
Loading…
x
Reference in New Issue
Block a user