diff --git a/.drone.yml b/.drone.yml index ec74f30..ab66cde 100644 --- a/.drone.yml +++ b/.drone.yml @@ -31,7 +31,7 @@ steps: - name: link-validation image: thegeeklab/link-validator commands: - - link-validator -ro + - link-validator -ro --exclude "https://github.com/thegeeklab/hugo-geekdoc/edit/master/*" environment: LINK_VALIDATOR_BASE_DIR: exampleSite/public @@ -242,6 +242,6 @@ depends_on: --- kind: signature -hmac: 9ffa1706ed0a3368bafa619e2fe5dd07db1813c9c8f9e7b54a3f4e722393ffce +hmac: c9b760d5d37c992b0caba32b3a4cf1933174c63453f263b96abec8387d340dd7 ... diff --git a/exampleSite/content/collapse/_index.md b/exampleSite/content/collapse/_index.md new file mode 100644 index 0000000..925425d --- /dev/null +++ b/exampleSite/content/collapse/_index.md @@ -0,0 +1,6 @@ +--- +title: Collapse +geekdocCollapseSection: true +--- + +Demo collapsible menu entries. diff --git a/exampleSite/content/collapse/level-1/_index.md b/exampleSite/content/collapse/level-1/_index.md new file mode 100644 index 0000000..acab06a --- /dev/null +++ b/exampleSite/content/collapse/level-1/_index.md @@ -0,0 +1,7 @@ +Level 1 + + + +{{< toc-tree >}} + + diff --git a/exampleSite/content/collapse/level-1/level-1-1.md b/exampleSite/content/collapse/level-1/level-1-1.md new file mode 100644 index 0000000..bf6896c --- /dev/null +++ b/exampleSite/content/collapse/level-1/level-1-1.md @@ -0,0 +1,5 @@ +--- +title: Level 1.1 +--- + +Level 1.1 diff --git a/exampleSite/content/collapse/level-1/level-1-2.md b/exampleSite/content/collapse/level-1/level-1-2.md new file mode 100644 index 0000000..317b0fe --- /dev/null +++ b/exampleSite/content/collapse/level-1/level-1-2.md @@ -0,0 +1,5 @@ +--- +title: Level 1.2 +--- + +Level 1.2 diff --git a/exampleSite/content/collapse/level-2/_index.md b/exampleSite/content/collapse/level-2/_index.md new file mode 100644 index 0000000..1671355 --- /dev/null +++ b/exampleSite/content/collapse/level-2/_index.md @@ -0,0 +1,5 @@ +--- +geekdocCollapseSection: true +--- + +Level-2 diff --git a/exampleSite/content/collapse/level-2/level-2-1.md b/exampleSite/content/collapse/level-2/level-2-1.md new file mode 100644 index 0000000..3b29aab --- /dev/null +++ b/exampleSite/content/collapse/level-2/level-2-1.md @@ -0,0 +1,5 @@ +--- +title: Level 2.1 +--- + +Level 2.1 diff --git a/exampleSite/content/collapse/level-2/level-2-2.md b/exampleSite/content/collapse/level-2/level-2-2.md new file mode 100644 index 0000000..ca0a397 --- /dev/null +++ b/exampleSite/content/collapse/level-2/level-2-2.md @@ -0,0 +1,5 @@ +--- +title: Level 2.2 +--- + +Level 2.2 diff --git a/exampleSite/content/shortcodes/_index.md b/exampleSite/content/shortcodes/_index.md new file mode 100644 index 0000000..c53e91c --- /dev/null +++ b/exampleSite/content/shortcodes/_index.md @@ -0,0 +1,4 @@ +--- +title: Shortcodes +weight: -10 +--- diff --git a/exampleSite/content/usage/_index.md b/exampleSite/content/usage/_index.md index eab4aee..64a6d91 100644 --- a/exampleSite/content/usage/_index.md +++ b/exampleSite/content/usage/_index.md @@ -1,4 +1,4 @@ --- title: Usage -weight: -10 +weight: -20 --- diff --git a/exampleSite/content/usage/configuration.md b/exampleSite/content/usage/configuration.md index 8cf9418..0d2386d 100644 --- a/exampleSite/content/usage/configuration.md +++ b/exampleSite/content/usage/configuration.md @@ -207,6 +207,9 @@ geekdocHidden = true # NOTE: Only applies when 'geekdocHidden = true'. geekdocHiddenTocTree = true +# Set to true to make a section foldable in side menu (file-tree menu only) +geekdocCollapseSection = true + # Add an anchor link to headlines geekdocAnchor = true ``` @@ -251,6 +254,9 @@ geekdocHidden: true # NOTE: Only applies when 'geekdocHidden: true'. geekdocHiddenTocTree: true +# Set to true to make a section foldable in side menu (file-tree menu only) +geekdocCollapseSection: true + # Add an anchor link to headlines geekdocAnchor: true ``` diff --git a/layouts/partials/menu-filetree.html b/layouts/partials/menu-filetree.html index 2ccfd06..10ec7ae 100644 --- a/layouts/partials/menu-filetree.html +++ b/layouts/partials/menu-filetree.html @@ -9,7 +9,18 @@ {{ range .sect.GroupBy "Weight" }} {{ range .ByTitle }} {{ if not .Params.GeekdocHidden }} + + {{ $numberOfPages := (add (len .Pages) (len .Sections)) }} + {{ $isParent := and (ne $numberOfPages 0) (not .Params.GeekdocFlatSection) }} + {{ $isCurrent := eq $current . }} + {{ $isAncestor := .IsAncestor $current }} + {{ $id := substr (sha1 .Permalink) 0 8 }} +