Add dropdown menu option for landing page

This commit is contained in:
Alex Shpak
2025-09-04 00:17:38 +02:00
parent 564c0b07ad
commit dbaaa516e8
5 changed files with 48 additions and 14 deletions
+24 -13
View File
@@ -41,7 +41,7 @@ img {
@include outline; @include outline;
} }
aside nav ul { nav ul {
padding: 0; padding: 0;
margin: 0; margin: 0;
list-style: none; list-style: none;
@@ -212,22 +212,33 @@ body[dir="rtl"] .book-menu {
height: 1.5em; height: 1.5em;
width: 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 { .book-layout-landing .book-header {
display: block; 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 { .book-search {
+12
View File
@@ -43,6 +43,18 @@ enableGitInfo = true
url = "/docs/example/" url = "/docs/example/"
weight = 1 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]] [[menu.home]]
name = "Showcases" name = "Showcases"
url = "/showcases/" url = "/showcases/"
+8
View File
@@ -40,6 +40,14 @@ menu:
- name: "Documentation" - name: "Documentation"
url: "/docs/example/" url: "/docs/example/"
weight: 1 weight: 1
- name: "Introduction"
url: "/docs/example/"
weight: 10
parent: "Documentation"
- name: "Shortcodes"
url: "/docs/shortcodes/badges/"
weight: 20
parent: "Documentation"
- name: "Showcases" - name: "Showcases"
url: "/showcases/" url: "/showcases/"
weight: 2 weight: 2
+2 -1
View File
@@ -10,7 +10,8 @@
<ul> <ul>
{{ range . }} {{ range . }}
<li> <li>
<a href="{{ .URL }}" {{ with .Params.class }}class="{{ . }}"{{ end }} {{ if not .Page }}target="_blank" rel="noopener"{{ end }}> {{ $local := or (.Page) (strings.HasPrefix .URL "/") }}
<a href="{{ .URL }}" {{ with .Params.class }}class="{{ . }}"{{ end }} {{ if not $local }}target="_blank" rel="noopener"{{ end }}>
{{- .Pre -}} {{- .Pre -}}
{{ with .Page }} {{ with .Page }}
{{ partial "docs/title" .Page }} {{ partial "docs/title" .Page }}
+2
View File
@@ -9,5 +9,7 @@
{{ end }} {{ end }}
{{ define "header" }} {{ define "header" }}
<nav>
{{ partial "docs/menu-hugo" .Site.Menus.home }} {{ partial "docs/menu-hugo" .Site.Menus.home }}
</nav>
{{ end }} {{ end }}