Skip to content

Commit

Permalink
Avoid warning 'calling IsSet with unsupported type "invalid" (<nil>)'
Browse files Browse the repository at this point in the history
  • Loading branch information
deining authored and chalin committed Mar 8, 2023
1 parent 7f0bc03 commit 50a59a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
17 changes: 13 additions & 4 deletions layouts/partials/sidebar-tree.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{{/* 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 -}}
{{/* 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 -}}
{{ $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 @@ -26,8 +29,14 @@
{{ end -}}
{{ $navRoot := cond (and (ne .Params.toc_root true) (eq .Site.Home.Type "docs")) .Site.Home .FirstSection -}}
{{ $ulNr := 0 -}}
{{ $ulShow := cond (isset .Site.Params.ui "ul_show") .Site.Params.ui.ul_show 1 -}}
{{ $sidebarMenuTruncate := cond (isset .Site.Params.ui "sidebar_menu_truncate") .Site.Params.ui.sidebar_menu_truncate 50 -}}
{{ $ulShow := 1 -}}
{{ with .Site.Params.ui.ul_show -}}
{{ $ulShow = . -}}
{{ end -}}
{{ $sidebarMenuTruncate := 50 -}}
{{ with .Site.Params.ui.sidebar_menu_truncate -}}
{{ $sidebarMenuTruncate = . -}}
{{ end -}}
<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
12 changes: 9 additions & 3 deletions layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{{/* The "active" toggle here may delay rendering, so we only cache this side bar menu for bigger sites.
*/}}{{ $sidebarCacheLimit := cond (isset .Site.Params.ui "sidebar_cache_limit") .Site.Params.ui.sidebar_cache_limit 2000 -}}
{{/* 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 -}}
{{ $shouldCache := ge (len .Site.Pages) $sidebarCacheLimit -}}
{{ $sidebarCacheTypeRoot := cond (isset .Site.Params.ui "sidebar_cache_type_root") .Site.Params.ui.sidebar_cache_type_root false -}}
{{ $sidebarCacheTypeRoot := false -}}
{{ with .Site.Params.ui.sidebar_cache_type_root -}}
{{ $sidebarCacheTypeRoot = . -}}
{{ end -}}
{{ if $shouldCache -}}
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }}
<script>
Expand Down

0 comments on commit 50a59a6

Please sign in to comment.