From 1e1d1c87169797e1709052d5f6fe83a07b4dac6a Mon Sep 17 00:00:00 2001 From: Xin Date: Tue, 24 Oct 2023 21:39:43 +0100 Subject: [PATCH] chore: add back mobile nav --- layouts/partials/sidebar.html | 19 ++++++++++--------- layouts/partials/sidebar/extra.html | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 33f9220..030fcaa 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -16,14 +16,15 @@
{{/* Sidebar on large screen */}}
@@ -31,7 +32,7 @@ {{ partial "sidebar/switches" (dict "context" $context "disableSidebar" $disableSidebar) }} -{{- define "partials/sidebar/render-tree" -}} +{{- define "sidebar-render-tree" -}} {{- $context := .context -}} {{- $page := .page -}} {{- $pageLink := .page.RelPermalink -}} @@ -39,15 +40,15 @@ {{- $active := eq $pageLink .link -}} {{- $shouldOpen := or (.open) (hasPrefix $pageLink .link) $active | default true }}
  • - {{- partial "sidebar/link" (dict "context" . "active" $active "title" .title "link" .link) -}} + {{- template "sidebar-item-link" (dict "context" . "active" $active "title" .title "link" .link) -}} {{- if .section -}} - {{- partial "sidebar/render-tree-branch" (dict "context" $context "entry" .section "page" $page) -}} + {{- template "sidebar-render-tree-branch" (dict "context" $context "entry" .section "page" $page) -}} {{- end -}}
  • {{ end }} {{- end -}} -{{- define "partials/sidebar/render-tree-branch" -}} +{{- define "sidebar-render-tree-branch" -}} {{- $context := .context -}} {{- $page := .page -}} {{- $entry := .entry -}} @@ -59,9 +60,9 @@ {{- $active := eq $pageLink .link -}} {{- $shouldOpen := or (.open) (hasPrefix $pageLink .link) $active | default true }}
  • - {{- partial "sidebar/link" (dict "context" . "active" $active "title" .title "link" .link) -}} + {{- template "sidebar-item-link" (dict "context" . "active" $active "title" .title "link" .link) -}} {{- if .section -}} - {{- partial "sidebar/render-tree-branch" (dict "context" $context "entry" .section "page" $page) -}} + {{- template "sidebar-render-tree-branch" (dict "context" $context "entry" .section "page" $page) -}} {{- end -}}
  • {{- end -}} @@ -75,7 +76,7 @@ {{- end -}} -{{- define "partials/sidebar/link" -}} +{{- define "sidebar-item-link" -}} {{- $external := strings.HasPrefix .link "http" -}} {{ $name }} {{ else }} -
  • {{ partial "sidebar/link" (dict "active" false "title" $name "link" (.URL | relLangURL)) }}
  • +
  • {{ template "sidebar-item-link" (dict "active" false "title" $name "link" (.URL | relLangURL)) }}
  • {{ end }} {{- end -}}