From 4f9365181d64918a57b694d3b3ab9f158c6e5a22 Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Tue, 18 Jan 2022 20:48:17 +0100 Subject: [PATCH 1/8] feat: add multi level section menu --- config/_default/menus/menus.en.toml | 6 ++ content/en/docs/lorem/_index.md | 10 +++ content/en/docs/lorem/ipsum/_index.md | 15 ++++ content/en/docs/lorem/ipsum/amet/_index.md | 15 ++++ .../lorem/ipsum/amet/consectetur/index.md | 14 ++++ content/en/docs/lorem/ipsum/dolor/index.md | 14 ++++ content/en/docs/lorem/ipsum/sit/index.md | 14 ++++ layouts/partials/sidebar/docs-menu.html | 81 ++++++++++++++++++- 8 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 content/en/docs/lorem/_index.md create mode 100644 content/en/docs/lorem/ipsum/_index.md create mode 100644 content/en/docs/lorem/ipsum/amet/_index.md create mode 100644 content/en/docs/lorem/ipsum/amet/consectetur/index.md create mode 100644 content/en/docs/lorem/ipsum/dolor/index.md create mode 100644 content/en/docs/lorem/ipsum/sit/index.md diff --git a/config/_default/menus/menus.en.toml b/config/_default/menus/menus.en.toml index 935d480..260f33a 100644 --- a/config/_default/menus/menus.en.toml +++ b/config/_default/menus/menus.en.toml @@ -10,6 +10,12 @@ identifier = "help" url = "/docs/help/" +[[docs]] + name = "Lorem" + weight = 70 + identifier = "lorem" + url = "/docs/lorem/" + [[main]] name = "Docs" url = "/docs/prologue/introduction/" diff --git a/content/en/docs/lorem/_index.md b/content/en/docs/lorem/_index.md new file mode 100644 index 0000000..c598920 --- /dev/null +++ b/content/en/docs/lorem/_index.md @@ -0,0 +1,10 @@ +--- +title: "Lorem" +description: "" +lead: "" +date: 2022-01-18T19:58:14+01:00 +lastmod: 2022-01-18T19:58:14+01:00 +draft: false +images: [] +toc: true +--- diff --git a/content/en/docs/lorem/ipsum/_index.md b/content/en/docs/lorem/ipsum/_index.md new file mode 100644 index 0000000..e575fc5 --- /dev/null +++ b/content/en/docs/lorem/ipsum/_index.md @@ -0,0 +1,15 @@ +--- +title: "Ipsum" +description: "" +lead: "" +date: 2022-01-18T20:00:32+01:00 +lastmod: 2022-01-18T20:00:32+01:00 +draft: false +images: [] +menu: + docs: + parent: "lorem" + identifier: "ipsum" +weight: 999 +toc: true +--- diff --git a/content/en/docs/lorem/ipsum/amet/_index.md b/content/en/docs/lorem/ipsum/amet/_index.md new file mode 100644 index 0000000..dbbeabd --- /dev/null +++ b/content/en/docs/lorem/ipsum/amet/_index.md @@ -0,0 +1,15 @@ +--- +title: "Amet" +description: "" +lead: "" +date: 2022-01-18T20:07:56+01:00 +lastmod: 2022-01-18T20:07:56+01:00 +draft: false +images: [] +menu: + docs: + parent: "ipsum" + identifier: "amet" +weight: 999 +toc: true +--- diff --git a/content/en/docs/lorem/ipsum/amet/consectetur/index.md b/content/en/docs/lorem/ipsum/amet/consectetur/index.md new file mode 100644 index 0000000..23771e3 --- /dev/null +++ b/content/en/docs/lorem/ipsum/amet/consectetur/index.md @@ -0,0 +1,14 @@ +--- +title: "Consectetur" +description: "" +lead: "" +date: 2022-01-18T20:17:32+01:00 +lastmod: 2022-01-18T20:17:32+01:00 +draft: false +images: [] +menu: + docs: + parent: "amet" +weight: 730 +toc: true +--- diff --git a/content/en/docs/lorem/ipsum/dolor/index.md b/content/en/docs/lorem/ipsum/dolor/index.md new file mode 100644 index 0000000..a744e72 --- /dev/null +++ b/content/en/docs/lorem/ipsum/dolor/index.md @@ -0,0 +1,14 @@ +--- +title: "Dolor" +description: "" +lead: "" +date: 2022-01-18T20:01:45+01:00 +lastmod: 2022-01-18T20:01:45+01:00 +draft: false +images: [] +menu: + docs: + parent: "ipsum" +weight: 700 +toc: true +--- diff --git a/content/en/docs/lorem/ipsum/sit/index.md b/content/en/docs/lorem/ipsum/sit/index.md new file mode 100644 index 0000000..e4c84e4 --- /dev/null +++ b/content/en/docs/lorem/ipsum/sit/index.md @@ -0,0 +1,14 @@ +--- +title: "Sit" +description: "" +lead: "" +date: 2022-01-18T20:05:19+01:00 +lastmod: 2022-01-18T20:05:19+01:00 +draft: false +images: [] +menu: + docs: + parent: "ipsum" +weight: 710 +toc: true +--- diff --git a/layouts/partials/sidebar/docs-menu.html b/layouts/partials/sidebar/docs-menu.html index cd383bb..fcdc21b 100644 --- a/layouts/partials/sidebar/docs-menu.html +++ b/layouts/partials/sidebar/docs-menu.html @@ -1,3 +1,81 @@ + + + From 44a41db76199b6e3e72c18c8f88636dc432d1251 Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Wed, 19 Jan 2022 17:21:41 +0100 Subject: [PATCH 2/8] feat: add multi level section menu --- config/_default/params.toml | 2 +- layouts/partials/sidebar/docs-menu.html | 157 +++++++++--------------- 2 files changed, 59 insertions(+), 100 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index b9f36ca..dcbc7bd 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -81,7 +81,7 @@ lastMod = false flexSearch = true darkMode = true bootStrapJs = true - breadCrumb = false + breadCrumb = true highLight = true kaTex = false collapsibleSidebar = true diff --git a/layouts/partials/sidebar/docs-menu.html b/layouts/partials/sidebar/docs-menu.html index fcdc21b..316de10 100644 --- a/layouts/partials/sidebar/docs-menu.html +++ b/layouts/partials/sidebar/docs-menu.html @@ -1,104 +1,64 @@ - - - From f0edb03105ffc7a18f6a3b4dda58f311a3a2c0d3 Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Thu, 20 Jan 2022 15:37:15 +0100 Subject: [PATCH 3/8] feat: add auto collapsibile multi level section menu --- config/_default/params.toml | 11 ++++- layouts/partials/sidebar/docs-menu.html | 66 ++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 3 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index dcbc7bd..d1708ca 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -74,6 +74,10 @@ docsRepoBranch = "master" editPage = false lastMod = false + +mainSections = ["docs"] + + [options] lazySizes = true clipBoard = true @@ -84,6 +88,11 @@ lastMod = false breadCrumb = true highLight = true kaTex = false - collapsibleSidebar = true multilingualMode = false docsVersioning = false + +[menu] + + [menu.section] + auto = false + collapsibleSidebar = false diff --git a/layouts/partials/sidebar/docs-menu.html b/layouts/partials/sidebar/docs-menu.html index 316de10..2d73be4 100644 --- a/layouts/partials/sidebar/docs-menu.html +++ b/layouts/partials/sidebar/docs-menu.html @@ -1,4 +1,65 @@ -{{ if .Site.Params.options.collapsibleSidebar -}} +{{ if and .Site.Params.menu.section.auto .Site.Params.menu.section.collapsibleSidebar -}} + +
    + {{ $currentPage := . -}} + {{ range (where .Site.Sections "Type" "in" site.Params.mainSections) }} + {{ range .Sections.Reverse }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
  • + +
    +
      + {{ range .Pages }} + {{ if .IsNode }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
    • + +
      +
        + {{ range .Pages }} + {{ if .IsNode }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
      • + +
        +
          + {{ range .Pages }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
        • {{ .Title }}
        • + {{ end }} +
        +
        +
      • + {{ else }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
      • {{ .Title }}
      • + {{ end }} + {{ end }} +
      +
      +
    • + {{ else }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
    • {{ .Title }}
    • + {{ end }} + {{ end }} +
    +
    +
  • + {{ end }} + {{ end }} +
+{{ else if and .Site.Params.menu.section.auto (not .Site.Params.menu.section.collapsibleSidebar) -}} + + +{{ else if and (not .Site.Params.menu.section.auto) .Site.Params.menu.section.collapsibleSidebar -}} +
    {{ $currentPage := . -}} {{ range $index, $element := .Site.Menus.docs -}} @@ -60,7 +121,8 @@ {{ end -}}
-{{ else -}} +{{ else if and (not .Site.Params.menu.section.auto) (not .Site.Params.menu.section.collapsibleSidebar) -}} + {{ $currentPage := . -}} {{ range .Site.Menus.docs -}}

{{ .Name }}

From 3e384f393db4c46e4ae30e4ccb67e1022bbc2251 Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Thu, 20 Jan 2022 18:00:31 +0100 Subject: [PATCH 4/8] feat: add manual multi level default section menu --- config/_default/params.toml | 5 ++- layouts/partials/sidebar/docs-menu.html | 42 ++++++++++++++++++++----- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index d1708ca..4cde9cb 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -92,7 +92,6 @@ mainSections = ["docs"] docsVersioning = false [menu] - [menu.section] - auto = false - collapsibleSidebar = false + auto = true + collapsibleSidebar = true diff --git a/layouts/partials/sidebar/docs-menu.html b/layouts/partials/sidebar/docs-menu.html index 2d73be4..299b0ef 100644 --- a/layouts/partials/sidebar/docs-menu.html +++ b/layouts/partials/sidebar/docs-menu.html @@ -125,15 +125,41 @@ {{ $currentPage := . -}} {{ range .Site.Menus.docs -}} -

{{ .Name }}

+

{{ .Name }}

{{ if .HasChildren -}} -
    - {{ range .Children -}} - {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} - {{- $active = or $active (eq $currentPage.Section .Identifier) -}} -
  • {{ .Name }}
  • - {{ end -}} -
+
    + {{ range .Children -}} + {{ if .HasChildren -}} +

    {{ .Name }}

    + {{ if .HasChildren -}} +
      + {{ range .Children -}} + {{ if .HasChildren -}} +
      {{ .Name }}
      + {{ if .HasChildren -}} +
        + {{ range .Children -}} + {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} +
      • {{ .Name }}
      • + {{ end -}} +
      + {{ end -}} + {{ else -}} + {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} +
    • {{ .Name }}
    • + {{ end -}} + {{ end -}} +
    + {{ end -}} + {{ else -}} + {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} +
  • {{ .Name }}
  • + {{ end -}} + {{ end -}} +
{{ end -}} {{ end -}} {{ end -}} From ab5584984a1056b44cc52f0ecdcb3246744591f2 Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Tue, 25 Jan 2022 16:27:13 +0100 Subject: [PATCH 5/8] setup: separate section menu logic from menu building --- config/_default/params.toml | 7 +- content/en/tutorial/_index.md | 8 + content/en/tutorial/lorem/_index.md | 8 + content/en/tutorial/lorem/ipsum/index.md | 8 + .../sidebar/auto-collapsible-menu.html | 56 ++++++ .../partials/sidebar/auto-default-menu.html | 1 + layouts/partials/sidebar/docs-menu.html | 166 +----------------- .../sidebar/manual-collapsible-menu.html | 62 +++++++ .../partials/sidebar/manual-default-menu.html | 40 +++++ 9 files changed, 190 insertions(+), 166 deletions(-) create mode 100644 content/en/tutorial/_index.md create mode 100644 content/en/tutorial/lorem/_index.md create mode 100644 content/en/tutorial/lorem/ipsum/index.md create mode 100644 layouts/partials/sidebar/auto-collapsible-menu.html create mode 100644 layouts/partials/sidebar/auto-default-menu.html create mode 100644 layouts/partials/sidebar/manual-collapsible-menu.html create mode 100644 layouts/partials/sidebar/manual-default-menu.html diff --git a/config/_default/params.toml b/config/_default/params.toml index 4cde9cb..1f9ef10 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -74,10 +74,6 @@ docsRepoBranch = "master" editPage = false lastMod = false - -mainSections = ["docs"] - - [options] lazySizes = true clipBoard = true @@ -93,5 +89,6 @@ mainSections = ["docs"] [menu] [menu.section] - auto = true + auto = false collapsibleSidebar = true + mainSections = ["docs", "tutorial"] diff --git a/content/en/tutorial/_index.md b/content/en/tutorial/_index.md new file mode 100644 index 0000000..cbc581f --- /dev/null +++ b/content/en/tutorial/_index.md @@ -0,0 +1,8 @@ +--- +title: "Tutorial" +description: "" +date: 2022-01-25T14:40:56+01:00 +lastmod: 2022-01-25T14:40:56+01:00 +draft: false +images: [] +--- diff --git a/content/en/tutorial/lorem/_index.md b/content/en/tutorial/lorem/_index.md new file mode 100644 index 0000000..a837257 --- /dev/null +++ b/content/en/tutorial/lorem/_index.md @@ -0,0 +1,8 @@ +--- +title: "Lorem" +description: "" +date: 2022-01-25T14:41:21+01:00 +lastmod: 2022-01-25T14:41:21+01:00 +draft: false +images: [] +--- diff --git a/content/en/tutorial/lorem/ipsum/index.md b/content/en/tutorial/lorem/ipsum/index.md new file mode 100644 index 0000000..58860ff --- /dev/null +++ b/content/en/tutorial/lorem/ipsum/index.md @@ -0,0 +1,8 @@ +--- +title: "Ipsum" +description: "" +date: 2022-01-25T14:41:39+01:00 +lastmod: 2022-01-25T14:41:39+01:00 +draft: false +images: [] +--- diff --git a/layouts/partials/sidebar/auto-collapsible-menu.html b/layouts/partials/sidebar/auto-collapsible-menu.html new file mode 100644 index 0000000..8ed4fb4 --- /dev/null +++ b/layouts/partials/sidebar/auto-collapsible-menu.html @@ -0,0 +1,56 @@ + +
    + {{ $currentPage := . -}} + {{ range (where .Site.Sections "Section" "in" site.Params.menu.section.mainSections) }} + {{ range .Sections.Reverse }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
  • + +
    +
      + {{ range .Pages }} + {{ if .IsNode }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
    • + +
      +
        + {{ range .Pages }} + {{ if .IsNode }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
      • + +
        +
          + {{ range .Pages }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
        • {{ .Title }}
        • + {{ end }} +
        +
        +
      • + {{ else }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
      • {{ .Title }}
      • + {{ end }} + {{ end }} +
      +
      +
    • + {{ else }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
    • {{ .Title }}
    • + {{ end }} + {{ end }} +
    +
    +
  • + {{ end }} + {{ end }} +
\ No newline at end of file diff --git a/layouts/partials/sidebar/auto-default-menu.html b/layouts/partials/sidebar/auto-default-menu.html new file mode 100644 index 0000000..19408ec --- /dev/null +++ b/layouts/partials/sidebar/auto-default-menu.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/layouts/partials/sidebar/docs-menu.html b/layouts/partials/sidebar/docs-menu.html index 299b0ef..b7baebb 100644 --- a/layouts/partials/sidebar/docs-menu.html +++ b/layouts/partials/sidebar/docs-menu.html @@ -1,165 +1,9 @@ {{ if and .Site.Params.menu.section.auto .Site.Params.menu.section.collapsibleSidebar -}} - -
    - {{ $currentPage := . -}} - {{ range (where .Site.Sections "Type" "in" site.Params.mainSections) }} - {{ range .Sections.Reverse }} - {{ $active := in $currentPage.RelPermalink .RelPermalink }} -
  • - -
    -
      - {{ range .Pages }} - {{ if .IsNode }} - {{ $active := in $currentPage.RelPermalink .RelPermalink }} -
    • - -
      -
        - {{ range .Pages }} - {{ if .IsNode }} - {{ $active := in $currentPage.RelPermalink .RelPermalink }} -
      • - -
        -
          - {{ range .Pages }} - {{ $active := in $currentPage.RelPermalink .RelPermalink }} -
        • {{ .Title }}
        • - {{ end }} -
        -
        -
      • - {{ else }} - {{ $active := in $currentPage.RelPermalink .RelPermalink }} -
      • {{ .Title }}
      • - {{ end }} - {{ end }} -
      -
      -
    • - {{ else }} - {{ $active := in $currentPage.RelPermalink .RelPermalink }} -
    • {{ .Title }}
    • - {{ end }} - {{ end }} -
    -
    -
  • - {{ end }} - {{ end }} -
+ {{ partial "sidebar/auto-collapsible-menu.html" . -}} {{ else if and .Site.Params.menu.section.auto (not .Site.Params.menu.section.collapsibleSidebar) -}} - - + {{ partial "sidebar/auto-default-menu.html" . -}} {{ else if and (not .Site.Params.menu.section.auto) .Site.Params.menu.section.collapsibleSidebar -}} - -
    - {{ $currentPage := . -}} - {{ range $index, $element := .Site.Menus.docs -}} - {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} - {{- $active = or $active (eq $currentPage.Section .Identifier) -}} -
  • - - {{ if .HasChildren -}} -
    -
      - {{ range .Children -}} - {{ if .HasChildren -}} -
    • - - {{ if .HasChildren -}} -
      -
        - {{ range .Children -}} - {{ if .HasChildren -}} -
      • - - {{ if .HasChildren -}} -
        -
          - {{ range .Children -}} - {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} - {{- $active = or $active (eq $currentPage.Section .Identifier) -}} -
        • {{ .Name }}
        • - {{ end -}} -
        -
        - {{ end -}} -
      • - {{ else -}} - {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} - {{- $active = or $active (eq $currentPage.Section .Identifier) -}} -
      • {{ .Name }}
      • - {{ end -}} - {{ end -}} -
      -
      - {{ end -}} -
    • - {{ else -}} - {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} - {{- $active = or $active (eq $currentPage.Section .Identifier) -}} -
    • {{ .Name }}
    • - {{ end -}} - {{ end -}} -
    -
    - {{ end -}} -
  • - {{ end -}} -
+ {{ partial "sidebar/manual-collapsible-menu.html" . -}} {{ else if and (not .Site.Params.menu.section.auto) (not .Site.Params.menu.section.collapsibleSidebar) -}} - - {{ $currentPage := . -}} - {{ range .Site.Menus.docs -}} -

{{ .Name }}

- {{ if .HasChildren -}} -
    - {{ range .Children -}} - {{ if .HasChildren -}} -

    {{ .Name }}

    - {{ if .HasChildren -}} -
      - {{ range .Children -}} - {{ if .HasChildren -}} -
      {{ .Name }}
      - {{ if .HasChildren -}} -
        - {{ range .Children -}} - {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} - {{- $active = or $active (eq $currentPage.Section .Identifier) -}} -
      • {{ .Name }}
      • - {{ end -}} -
      - {{ end -}} - {{ else -}} - {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} - {{- $active = or $active (eq $currentPage.Section .Identifier) -}} -
    • {{ .Name }}
    • - {{ end -}} - {{ end -}} -
    - {{ end -}} - {{ else -}} - {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} - {{- $active = or $active (eq $currentPage.Section .Identifier) -}} -
  • {{ .Name }}
  • - {{ end -}} - {{ end -}} -
- {{ end -}} - {{ end -}} -{{ end -}} + {{ partial "sidebar/manual-default-menu.html" . -}} +{{ end -}} \ No newline at end of file diff --git a/layouts/partials/sidebar/manual-collapsible-menu.html b/layouts/partials/sidebar/manual-collapsible-menu.html new file mode 100644 index 0000000..900d3a0 --- /dev/null +++ b/layouts/partials/sidebar/manual-collapsible-menu.html @@ -0,0 +1,62 @@ + +
    + {{ $currentPage := . -}} + {{ range $index, $element := .Site.Menus.docs -}} + {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} +
  • + + {{ if .HasChildren -}} +
    +
      + {{ range .Children -}} + {{ if .HasChildren -}} +
    • + + {{ if .HasChildren -}} +
      +
        + {{ range .Children -}} + {{ if .HasChildren -}} +
      • + + {{ if .HasChildren -}} +
        +
          + {{ range .Children -}} + {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} +
        • {{ .Name }}
        • + {{ end -}} +
        +
        + {{ end -}} +
      • + {{ else -}} + {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} +
      • {{ .Name }}
      • + {{ end -}} + {{ end -}} +
      +
      + {{ end -}} +
    • + {{ else -}} + {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} +
    • {{ .Name }}
    • + {{ end -}} + {{ end -}} +
    +
    + {{ end -}} +
  • + {{ end -}} +
\ No newline at end of file diff --git a/layouts/partials/sidebar/manual-default-menu.html b/layouts/partials/sidebar/manual-default-menu.html new file mode 100644 index 0000000..554b1e3 --- /dev/null +++ b/layouts/partials/sidebar/manual-default-menu.html @@ -0,0 +1,40 @@ + +{{ $currentPage := . -}} +{{ range .Site.Menus.docs -}} +

{{ .Name }}

+ {{ if .HasChildren -}} +
    + {{ range .Children -}} + {{ if .HasChildren -}} +

    {{ .Name }}

    + {{ if .HasChildren -}} +
      + {{ range .Children -}} + {{ if .HasChildren -}} +
      {{ .Name }}
      + {{ if .HasChildren -}} +
        + {{ range .Children -}} + {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} +
      • {{ .Name }}
      • + {{ end -}} +
      + {{ end -}} + {{ else -}} + {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} +
    • {{ .Name }}
    • + {{ end -}} + {{ end -}} +
    + {{ end -}} + {{ else -}} + {{- $active := or ($currentPage.IsMenuCurrent "docs" .) ($currentPage.HasMenuCurrent "docs" .) -}} + {{- $active = or $active (eq $currentPage.Section .Identifier) -}} +
  • {{ .Name }}
  • + {{ end -}} + {{ end -}} +
+ {{ end -}} +{{ end -}} \ No newline at end of file From 0e8cd3c3209a21650456192472a6fc0d0cca0d7a Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Tue, 25 Jan 2022 16:30:34 +0100 Subject: [PATCH 6/8] config: set section menu to auto collapsible --- config/_default/params.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index 1f9ef10..076c8aa 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -89,6 +89,6 @@ lastMod = false [menu] [menu.section] - auto = false + auto = true collapsibleSidebar = true mainSections = ["docs", "tutorial"] From 9e5ef02e7a312fd24291f291cfdf9e9633b43119 Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Wed, 26 Jan 2022 14:36:47 +0100 Subject: [PATCH 7/8] feat: add auto default section menu --- config/_default/params.toml | 4 +- .../partials/sidebar/auto-default-menu.html | 37 ++++++++++++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index 076c8aa..88514bd 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -90,5 +90,5 @@ lastMod = false [menu] [menu.section] auto = true - collapsibleSidebar = true - mainSections = ["docs", "tutorial"] + collapsibleSidebar = false + mainSections = ["docs"] diff --git a/layouts/partials/sidebar/auto-default-menu.html b/layouts/partials/sidebar/auto-default-menu.html index 19408ec..9a0c9ea 100644 --- a/layouts/partials/sidebar/auto-default-menu.html +++ b/layouts/partials/sidebar/auto-default-menu.html @@ -1 +1,36 @@ - \ No newline at end of file + +{{ $currentPage := . -}} +{{ range (where .Site.Sections "Section" "in" site.Params.menu.section.mainSections) }} + {{ range .Sections.Reverse }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +

{{ .Title }}

+
    + {{ range .Pages }} + {{ if .IsNode }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +

    {{ .Title }}

    +
      + {{ range .Pages }} + {{ if .IsNode }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
      {{ .Title }}
      +
        + {{ range .Pages }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
      • {{ .Name }}
      • + {{ end }} +
      + {{ else }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
    • {{ .Name }}
    • + {{ end }} + {{ end }} +
    + {{ else }} + {{ $active := in $currentPage.RelPermalink .RelPermalink }} +
  • {{ .Name }}
  • + {{ end }} + {{ end }} +
+ {{ end }} +{{ end }} \ No newline at end of file From 5cf97870ae9f395fbd6b6eac7ad05068c44cbc5e Mon Sep 17 00:00:00 2001 From: Henk Verlinde Date: Wed, 26 Jan 2022 14:49:48 +0100 Subject: [PATCH 8/8] config: set for merge --- config/_default/params.toml | 4 ++-- content/en/docs/lorem/_index.md | 2 +- layouts/partials/sidebar/auto-collapsible-menu.html | 2 +- layouts/partials/sidebar/auto-default-menu.html | 2 +- layouts/partials/sidebar/manual-collapsible-menu.html | 2 +- layouts/partials/sidebar/manual-default-menu.html | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/config/_default/params.toml b/config/_default/params.toml index 88514bd..d7068be 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -81,7 +81,7 @@ lastMod = false flexSearch = true darkMode = true bootStrapJs = true - breadCrumb = true + breadCrumb = false highLight = true kaTex = false multilingualMode = false @@ -90,5 +90,5 @@ lastMod = false [menu] [menu.section] auto = true - collapsibleSidebar = false + collapsibleSidebar = true mainSections = ["docs"] diff --git a/content/en/docs/lorem/_index.md b/content/en/docs/lorem/_index.md index c598920..86fcd8f 100644 --- a/content/en/docs/lorem/_index.md +++ b/content/en/docs/lorem/_index.md @@ -4,7 +4,7 @@ description: "" lead: "" date: 2022-01-18T19:58:14+01:00 lastmod: 2022-01-18T19:58:14+01:00 -draft: false +draft: true images: [] toc: true --- diff --git a/layouts/partials/sidebar/auto-collapsible-menu.html b/layouts/partials/sidebar/auto-collapsible-menu.html index 8ed4fb4..202189f 100644 --- a/layouts/partials/sidebar/auto-collapsible-menu.html +++ b/layouts/partials/sidebar/auto-collapsible-menu.html @@ -1,4 +1,4 @@ - +
    {{ $currentPage := . -}} {{ range (where .Site.Sections "Section" "in" site.Params.menu.section.mainSections) }} diff --git a/layouts/partials/sidebar/auto-default-menu.html b/layouts/partials/sidebar/auto-default-menu.html index 9a0c9ea..f7519fe 100644 --- a/layouts/partials/sidebar/auto-default-menu.html +++ b/layouts/partials/sidebar/auto-default-menu.html @@ -1,4 +1,4 @@ - + {{ $currentPage := . -}} {{ range (where .Site.Sections "Section" "in" site.Params.menu.section.mainSections) }} {{ range .Sections.Reverse }} diff --git a/layouts/partials/sidebar/manual-collapsible-menu.html b/layouts/partials/sidebar/manual-collapsible-menu.html index 900d3a0..eaa864b 100644 --- a/layouts/partials/sidebar/manual-collapsible-menu.html +++ b/layouts/partials/sidebar/manual-collapsible-menu.html @@ -1,4 +1,4 @@ - +
      {{ $currentPage := . -}} {{ range $index, $element := .Site.Menus.docs -}} diff --git a/layouts/partials/sidebar/manual-default-menu.html b/layouts/partials/sidebar/manual-default-menu.html index 554b1e3..0eb3c52 100644 --- a/layouts/partials/sidebar/manual-default-menu.html +++ b/layouts/partials/sidebar/manual-default-menu.html @@ -1,4 +1,4 @@ - + {{ $currentPage := . -}} {{ range .Site.Menus.docs -}}

      {{ .Name }}