Refactor separator logic in navbar

Signed-off-by: hossainemruz <hossainemruz@gmail.com>
This commit is contained in:
hossainemruz 2021-05-02 05:00:55 +06:00
parent 12740acdf4
commit 69f5410cb6
2 changed files with 42 additions and 8 deletions

View file

@ -0,0 +1,25 @@
{{ $addNavbarSeparator:= false }}
{{/* If "blog" feature is enabled, then add navbar separator */}}
{{ if site.Params.features.blog.enable }}
{{ $addNavbarSeparator = true }}
{{ end }}
{{/* If "notes" feature is enabled, then add navbar separator */}}
{{ if site.Params.features.notes.enable }}
{{ $addNavbarSeparator = true }}
{{ end }}
{{/* If site has custom menus, then add navbar separator */}}
{{ $customMenus := site.Params.customMenus }}
{{ if (index site.Data site.Language.Lang).site.customMenus }}
{{ $customMenus = (index site.Data site.Language.Lang).site.customMenus }}
{{ end }}
{{ if $customMenus }}
{{ if gt (len $customMenus) 0 }}
{{ $addNavbarSeparator = true }}
{{ end }}
{{ end }}
{{ return $addNavbarSeparator }}