chore: basic structure using new sidebar data

This commit is contained in:
Xin
2024-04-05 21:30:24 +01:00
parent 462cc5b68d
commit fdfdef69b5
2 changed files with 20 additions and 23 deletions

View 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 }}