feat: submenus update

This commit is contained in:
Mirus 2024-08-02 16:35:24 +03:00
parent e755de9f42
commit 4ab072273d
5 changed files with 71 additions and 7 deletions

View File

@ -2,13 +2,13 @@
## Welcome to Hugo Theme re-Terminal! ## Welcome to Hugo Theme re-Terminal!
Hello! I'm thrilled to announce that we've received a brand new fork of Hugo Theme re-Terminal, now officially known as Hugo Theme Re-Terminal! Hello! I'm thrilled to announce a brand new fork of Hugo Theme Terminal, now officially known as Hugo Theme Re-Terminal!
As the maintainer, I'm excited to share that this theme will continue to evolve and receive updates with new features. Why? Because I use it myself! You can bet your last byte that any changes I make will be thoroughly tested and refined for real-world use. As the maintainer, I'm excited to share that this theme will continue to evolve and receive updates with new features. Why? Because I use it myself! You can bet your last byte that any changes I make will be thoroughly tested and refined for real-world use.
This fork aims to breathe new life into the original re-Terminal theme, which was once a popular choice among Hugo enthusiasts. Unfortunately, it had been neglected over time. But no more! With re-Terminal, we're committed to keeping the spirit of the original alive while adding fresh perspectives and innovations. This fork aims to breathe new life into the original Terminal theme, which was once a popular choice among Hugo enthusiasts. Unfortunately, it had been neglected over time. But no more! With re-Terminal, we're committed to keeping the spirit of the original alive while adding fresh perspectives and innovations.
In the coming weeks and months, you can expect to see new features, and bug fixes. We'll also be actively seeking feedback from our community to ensure that this theme continues to meet your needs and exceed your expectations. In the coming weeks and months, you can expect to see new features, and bug fixes. We'll also be actively seeking feedback from our community to ensure that this theme continues to meet your needs and exceed your expectations.
@ -18,10 +18,12 @@ So, welcome aboard! I'm excited to have you join us on this journey as we shape
---- ----
![Terminal](https://github.com/mirus-ua/hugo-theme-re-terminal/blob/main/images/screenshot.png?raw=true) ![re-Terminal](https://github.com/mirus-ua/hugo-theme-re-terminal/blob/main/images/screenshot.png?raw=true)
### DEMO - https://re-terminal.nebrowser.com/ ### DEMO and some blog posts about re-Terminal - https://re-terminal.nebrowser.com/
### Visit repo's wiki (WIP) - https://github.com/mirus-ua/hugo-theme-re-terminal/wiki
### ⚠️ The theme needs at least Hugo **Extended** v0.128.0. ### ⚠️ The theme needs at least Hugo **Extended** v0.128.0.
@ -267,6 +269,14 @@ paginate = 5
logoHomeLink = "/" logoHomeLink = "/"
[languages.en.menu] [languages.en.menu]
# Submenus is available since v2.1.0
# [[languages.en.menu.main]]
# identifier = "submenuParent"
# name = "Submenu"
# [[languages.en.menu.main]]
# parent = "submenuParent"
# identifier = "anItem"
# name = "AnItem"
[[languages.en.menu.main]] [[languages.en.menu.main]]
identifier = "about" identifier = "about"
name = "About" name = "About"
@ -287,7 +297,7 @@ paginate = 5
to `config.toml` file in your Hugo root directory and change params fields. In case you need, here's [a YAML version](https://gist.github.com/panr/9eeea6f595c257febdadc11763e3a6d1). to `config.toml` file in your Hugo root directory and change params fields. In case you need, here's [a YAML version](https://gist.github.com/panr/9eeea6f595c257febdadc11763e3a6d1).
**NOTE:** Please keep in mind that currently `main menu` doesn't support nesting. **NOTE:** Please keep in mind that `main menu` supports only one level of nesting.
## Post archetype ## Post archetype

View File

@ -87,6 +87,15 @@
cursor: pointer; cursor: pointer;
} }
&__subdrop {
&--title {
padding: 5px;
}
&--list {
list-style-type: unset;
}
}
&__dropdown { &__dropdown {
@include menu; @include menu;

View File

@ -6,7 +6,7 @@ paginate = 5
[params] [params]
contentTypeName = "posts" contentTypeName = "posts"
themeColor = "blue" themeColor = "blue"
showMenuItems = 2 showMenuItems = 3
fullWidthTheme = false fullWidthTheme = false
centerTheme = true centerTheme = true
[params.banner] [params.banner]
@ -29,6 +29,19 @@ logoText = "re-Terminal"
logoHomeLink = "/" logoHomeLink = "/"
[languages.en.menu] [languages.en.menu]
[[langiages.en.menu.main]]
identifier = "submenu"
name = "Now with submenus"
[[languages.en.menu.main]]
identifier = "subabout"
name = "About"
url = "/about"
parent = "submenu"
[[languages.en.menu.main]]
identifier = "subshowcase"
name = "Showcase"
url = "/showcase"
parent = "submenu"
[[languages.en.menu.main]] [[languages.en.menu.main]]
identifier = "about" identifier = "about"
name = "About" name = "About"

View File

@ -1,9 +1,23 @@
<nav class="navigation-menu"> <nav class="navigation-menu">
<ul class="navigation-menu__inner menu--desktop"> <ul class="navigation-menu__inner menu--desktop">
{{ if or $.Site.Params.showMenuItems ( eq .Site.Params.showMenuItems 0 ) }} {{ if or $.Site.Params.showMenuItems ( eq .Site.Params.showMenuItems 0 ) }}
{{/* get first amount of item */}}
{{ range first $.Site.Params.showMenuItems $.Site.Menus.main }} {{ range first $.Site.Params.showMenuItems $.Site.Menus.main }}
{{ if not .HasChildren }} {{ if not .HasChildren }}
<li><a href="{{ .URL }}" {{ if .Params.NewTab -}} target="_blank" {{- end }}>{{ .Name }}</a></li> <li><a href="{{ .URL }}" {{ if .Params.NewTab -}} target="_blank" {{- end }}>{{ .Name }}</a></li>
{{ else }}
<li>
<ul class="menu">
<li class="menu__trigger">{{ .Name }}&nbsp;</li>
<li>
<ul class="menu__dropdown">
{{ range .Children }}
<li><a href="{{ .URL }}" {{ if .Params.NewTab -}} target="_blank" {{- end }}>{{ .Name }}</a></li>
{{ end }}
</ul>
</li>
</ul>
</li>
{{end}} {{end}}
{{ end }} {{ end }}
{{ if gt (len $.Site.Menus.main) $.Site.Params.showMenuItems }} {{ if gt (len $.Site.Menus.main) $.Site.Params.showMenuItems }}
@ -15,6 +29,15 @@
{{ range last (sub (len $.Site.Menus.main) $.Site.Params.showMenuItems) $.Site.Menus.main }} {{ range last (sub (len $.Site.Menus.main) $.Site.Params.showMenuItems) $.Site.Menus.main }}
{{ if not .HasChildren }} {{ if not .HasChildren }}
<li><a href="{{ .URL }}" {{ if .Params.NewTab -}} target="_blank" {{- end }}>{{ .Name }}</a></li> <li><a href="{{ .URL }}" {{ if .Params.NewTab -}} target="_blank" {{- end }}>{{ .Name }}</a></li>
{{ else }}
<li class="menu__subdrop--title">&nbsp;{{ .Name }}</li>
<li>
<ul class="menu__subdrop--list">
{{ range .Children }}
<li><a href="{{ .URL }}" {{ if .Params.NewTab -}} target="_blank" {{- end }}>{{ .Name }}</a></li>
{{ end }}
</ul>
</li>
{{ end }} {{ end }}
{{ end }} {{ end }}
</ul> </ul>

View File

@ -5,6 +5,15 @@
{{ range $.Site.Menus.main }} {{ range $.Site.Menus.main }}
{{ if not .HasChildren }} {{ if not .HasChildren }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li> <li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ else }}
<li class="menu__subdrop--title">&nbsp;{{ .Name }}</li>
<li>
<ul class="menu__subdrop--list">
{{ range .Children }}
<li><a href="{{ .URL }}" {{ if .Params.NewTab -}} target="_blank" {{- end }}>{{ .Name }}</a></li>
{{ end }}
</ul>
</li>
{{ end }} {{ end }}
{{ end }} {{ end }}
{{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }} {{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }}