From dbaaa516e8ff72f8dd4591a49cea2ab2693865da Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Thu, 4 Sep 2025 00:17:38 +0200 Subject: [PATCH] Add dropdown menu option for landing page --- assets/_main.scss | 37 +++++++++++++++++---------- exampleSite/hugo.toml | 12 +++++++++ exampleSite/hugo.yaml | 8 ++++++ layouts/_partials/docs/menu-hugo.html | 3 ++- layouts/landing.html | 2 ++ 5 files changed, 48 insertions(+), 14 deletions(-) diff --git a/assets/_main.scss b/assets/_main.scss index cb4f366..5972bcc 100644 --- a/assets/_main.scss +++ b/assets/_main.scss @@ -41,7 +41,7 @@ img { @include outline; } -aside nav ul { +nav ul { padding: 0; margin: 0; list-style: none; @@ -212,22 +212,33 @@ body[dir="rtl"] .book-menu { height: 1.5em; width: 1.5em; } - - > ul { - margin: 0; - padding: 0 $padding-16; - display: flex; - gap: $padding-16; - justify-content: end; - - li { - display: inline-block; - } - } } .book-layout-landing .book-header { display: block; + position: relative; + z-index: 1; + + nav > ul { + display: flex; + gap: $padding-16; + justify-content: end; + + > li { + display: block; + white-space: nowrap; + + > ul { + display: none; + position: absolute; + padding: 0; + } + + &:hover > ul { + display: block; + } + } + } } .book-search { diff --git a/exampleSite/hugo.toml b/exampleSite/hugo.toml index 65cb052..f4b1358 100644 --- a/exampleSite/hugo.toml +++ b/exampleSite/hugo.toml @@ -43,6 +43,18 @@ enableGitInfo = true url = "/docs/example/" weight = 1 +[[menu.home]] + name = "Introduction" + url = "/docs/example/" + weight = 10 + parent = "Documentation" + +[[menu.home]] + name = "Shortcodes" + url = "/docs/shortcodes/badges/" + weight = 20 + parent = "Documentation" + [[menu.home]] name = "Showcases" url = "/showcases/" diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index b1260b0..62b2d49 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -40,6 +40,14 @@ menu: - name: "Documentation" url: "/docs/example/" weight: 1 + - name: "Introduction" + url: "/docs/example/" + weight: 10 + parent: "Documentation" + - name: "Shortcodes" + url: "/docs/shortcodes/badges/" + weight: 20 + parent: "Documentation" - name: "Showcases" url: "/showcases/" weight: 2 diff --git a/layouts/_partials/docs/menu-hugo.html b/layouts/_partials/docs/menu-hugo.html index 5f01be0..d23f5d1 100644 --- a/layouts/_partials/docs/menu-hugo.html +++ b/layouts/_partials/docs/menu-hugo.html @@ -10,7 +10,8 @@