Skip to content

Commit

Permalink
Incorporating reviewer feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
deining committed Mar 8, 2023
1 parent f8bb9b7 commit d310426
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 20 deletions.
15 changes: 3 additions & 12 deletions layouts/partials/sidebar-tree.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{{/* We cache this partial for bigger sites and set the active class client side. */ -}}
{{ $sidebarCacheLimit := 2000 -}}
{{ with .Site.Params.ui.sidebar_cache_limit -}}
{{ $sidebarCacheLimit = . -}}
{{ end -}}
{{ $sidebarCacheLimit := .Site.Params.ui.sidebar_cache_limit | default 2000 -}}
{{ $shouldDelayActive := ge (len .Site.Pages) $sidebarCacheLimit -}}
<div id="td-sidebar-menu" class="td-sidebar__inner{{ if $shouldDelayActive }} d-none{{ end }}">
{{ if not .Site.Params.ui.sidebar_search_disable -}}
Expand All @@ -29,14 +26,8 @@
{{ end -}}
{{ $navRoot := cond (and (ne .Params.toc_root true) (eq .Site.Home.Type "docs")) .Site.Home .FirstSection -}}
{{ $ulNr := 0 -}}
{{ $ulShow := 1 -}}
{{ with .Site.Params.ui.ul_show -}}
{{ $ulShow = . -}}
{{ end -}}
{{ $sidebarMenuTruncate := 50 -}}
{{ with .Site.Params.ui.sidebar_menu_truncate -}}
{{ $sidebarMenuTruncate = . -}}
{{ end -}}
{{ $ulShow := .Site.Params.ui.ul_show | default 1 -}}
{{ $sidebarMenuTruncate := .Site.Params.ui.sidebar_menu_truncate | default 50 -}}
<ul class="td-sidebar-nav__section pe-md-3 ul-{{ $ulNr }}">
{{ template "section-tree-nav-section" (dict "page" . "section" $navRoot "shouldDelayActive" $shouldDelayActive "sidebarMenuTruncate" $sidebarMenuTruncate "ulNr" $ulNr "ulShow" (add $ulShow 1)) }}
</ul>
Expand Down
10 changes: 2 additions & 8 deletions layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{{/* The "active" toggle here may delay rendering, so we only cache this side bar menu for bigger sites. */ -}}
{{ $sidebarCacheLimit := 2000 -}}
{{ with .Site.Params.ui.sidebar_cache_limit -}}
{{ $sidebarCacheLimit = . -}}
{{ end -}}
{{ $sidebarCacheLimit := .Site.Params.ui.sidebar_cache_limit | default 2000 -}}
{{ $shouldCache := ge (len .Site.Pages) $sidebarCacheLimit -}}
{{ $sidebarCacheTypeRoot := false -}}
{{ with .Site.Params.ui.sidebar_cache_type_root -}}
{{ $sidebarCacheTypeRoot = . -}}
{{ end -}}
{{ $sidebarCacheTypeRoot := .Site.Params.ui.sidebar_cache_type_root | default false -}}
{{ if $shouldCache -}}
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }}
<script>
Expand Down

0 comments on commit d310426

Please sign in to comment.