{{/* The blog nav organizes posts grouped by year, which represents a customized version of the sidebar-tree in use elsewhere on the site. */}} {{/* We cache this partial for bigger sites and set the active class client side. */}} {{ $sidebarCacheLimit := cond (isset .Site.Params.ui "sidebar_cache_limit") .Site.Params.ui.sidebar_cache_limit 2000 -}} {{ $shouldDelayActive := ge (len .Site.Pages) $sidebarCacheLimit -}}
{{ define "blog-section-tree-nav-section" -}} {{ $s := .section -}} {{ $p := .page -}} {{ $shouldDelayActive := .shouldDelayActive -}} {{ $sidebarMenuTruncate := .sidebarMenuTruncate -}} {{ $ulNr := .ulNr -}} {{ $ulShow := .ulShow -}} {{ $postsByYear := $s.Pages.GroupByDate "2006" }} {{ $active := and (not $shouldDelayActive) (eq $s $p) -}} {{ $activePath := and (not $shouldDelayActive) (or (eq $p $s) ($p.IsDescendant $s)) -}} {{ $show := cond (or (lt $ulNr $ulShow) $activePath (and (not $shouldDelayActive) (eq $s.Parent $p.Parent)) (and (not $shouldDelayActive) (eq $s.Parent $p)) (not $p.Site.Params.ui.sidebar_menu_compact) (and (not $shouldDelayActive) ($p.IsDescendant $s.Parent))) true false -}} {{ $mid := printf "m-%s" ($s.RelPermalink | anchorize) -}}