mirror of
https://github.com/imfing/hextra.git
synced 2025-07-01 22:17:17 -04:00
chore: basic structure using new sidebar data
This commit is contained in:
20
layouts/partials/components/sidebar/get-section-data.html
Normal file
20
layouts/partials/components/sidebar/get-section-data.html
Normal file
@ -0,0 +1,20 @@
|
||||
{{/* Get section 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 := "" }}
|
||||
{{ $section := .Section | default "" }}
|
||||
{{ $sidebarKey := "sidebar" }}
|
||||
|
||||
{{ if hugo.IsMultilingual }}
|
||||
{{ with (index site.Data site.Language.Lang $sidebarKey $section) }}
|
||||
{{ $data = . }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ with (index site.Data $sidebarKey $section) }}
|
||||
{{ $data = . }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $data }}
|
Reference in New Issue
Block a user