From 38a1fa7002ef08e761cf52b8b2b005bc7a9c11f8 Mon Sep 17 00:00:00 2001 From: Rafael-gc Date: Wed, 3 Jul 2024 13:34:04 -0300 Subject: [PATCH] Add accordions to docs menu Signed-off-by: Rafael-gc --- site/layouts/partials/tree.html | 128 ++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 54 deletions(-) diff --git a/site/layouts/partials/tree.html b/site/layouts/partials/tree.html index 6c00cd7c7..7da47501f 100644 --- a/site/layouts/partials/tree.html +++ b/site/layouts/partials/tree.html @@ -1,61 +1,81 @@
- -
    -{{- $here := .dir }} -{{- range (readDir $here) }} - {{ if in .Name "image" }} - {{ else }} - {{- $fullPath := (printf "%s%s" $here .Name) }} - {{- $fullUrl := replace $fullPath "/content" "" }} - {{- $stat := os.Stat $fullPath }} - {{ if $stat.IsDir }} - {{- template "treemenu" dict "path" $fullPath "url" $fullUrl "root" $.root "depth" 1 }} - {{ end }} - {{ end }} -{{- end -}} -
-
-{{ define "treemenu" }} - {{ $nextDepth := add .depth 1 }} - {{- $activeLink := $.root.Permalink }} - {{- $className := "" }} - {{- $deprecated := true }} - {{- with $.root.Site.GetPage .url }} - {{- if not .Params.deprecated }} - {{- $deprecated = false }} - {{- $branchLink := .Permalink }} - {{- if in $activeLink $branchLink }} - {{- $className = "tree-branch-active" -}} - {{ end }} - {{- if eq $activeLink $branchLink }} - {{- $className = "tree-active tree-branch-active" -}} - {{- end -}} -
  • - {{ .Title }} - {{- end }} - {{- end }} - {{- if not $deprecated }} -
      - {{- range (readDir .path) }} - {{- if in .Name "image" | or (eq .Name "_index.md") }} - {{- else }} - {{- $fullPath := (printf "%s/%s" $.path .Name) }} + +
        + {{- $here := .dir }} + {{- range (readDir $here) }} + {{- if not (in .Name "image") }} + {{- $fullPath := (printf "%s%s" $here .Name) }} {{- $fullUrl := replace $fullPath "/content" "" }} - {{- $fullUrl = replace $fullUrl ".md" "" }} {{- $stat := os.Stat $fullPath }} {{- if $stat.IsDir }} - {{- template "treemenu" dict "path" $fullPath "url" $fullUrl "root" $.root "depth" $nextDepth }} - {{- else }} - {{- with $.root.Site.GetPage $fullUrl }} - {{- $link := printf "%s" .Permalink }} - - {{ .Title }} - - {{- end }} + {{- template "treemenu" dict "path" $fullPath "url" $fullUrl "root" $.root "depth" 1 }} {{- end }} {{- end }} {{- end }} -
      - - {{- end }} -{{ end }} \ No newline at end of file +
    + + +{{ define "treemenu" }} + {{ $nextDepth := add .depth 1 }} + {{ $activeLink := $.root.Permalink }} + {{ $className := "" }} + {{ $deprecated := true }} + {{ with $.root.Site.GetPage .url }} + {{ if not .Params.deprecated }} + {{ $deprecated = false }} + {{ $branchLink := .Permalink }} + {{ if in $activeLink $branchLink }} + {{ $className = "tree-branch-active" }} + {{ end }} + {{ if eq $activeLink $branchLink }} + {{ $className = "tree-active tree-branch-active" }} + {{ end }} +
  • + {{ .Title }} + {{ if lt $.depth 3 }} + + {{ end }} +
  • + {{ end }} + {{ end }} +{{ end }} + \ No newline at end of file