Remove deprecated bundle/leaf menu type

pull/552/merge
Alex Shpak 2024-10-02 16:14:53 +02:00
parent 2f64607bc9
commit 31662538df
5 changed files with 6 additions and 64 deletions

View File

@ -92,44 +92,8 @@ hugo server --minify --theme hugo-book
## Menu
### File tree menu (default)
By default, the theme will render pages from the `content/docs` section as a menu in a tree structure.
You can set `title` and `weight` in the front matter of pages to adjust the order and titles in the menu.
### Leaf bundle menu (Deprecated, to be removed in June 2022)
You can also use leaf bundle and the content of its `index.md` file as menu.
Given you have the following file structure:
```
├── content
│ ├── docs
│ │ ├── page-one.md
│ │ └── page-two.md
│ └── posts
│ ├── post-one.md
│ └── post-two.md
```
Create a file `content/menu/index.md` with the content:
```md
+++
headless = true
+++
- [Book Example]({{< relref "/docs/" >}})
- [Page One]({{< relref "/docs/page-one" >}})
- [Page Two]({{< relref "/docs/page-two" >}})
- [Blog]({{< relref "/posts" >}})
```
And Enable it by setting `BookMenuBundle: /menu` in Site configuration.
- [Example menu](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/content.en/menu/index.md)
- [Example config file](https://github.com/alex-shpak/hugo-book/blob/master/exampleSite/hugo.yaml)
- [Leaf bundles](https://gohugo.io/content-management/page-bundles/)
You can set `title` and `weight` in the front matter of pages to adjust the order and titles in the menu, as well as other parameters to hide or alter urls in the menu. You can choose which folder to use for generating menu with `BookSection` configuration parameter.
## Blog
@ -177,11 +141,6 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
# /static/logo.png then the path would be 'logo.png'
BookLogo = 'logo.png'
# (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used
# Deprecated, to be removed in June 2022
BookMenuBundle = '/menu'
# (Optional, default docs) Specify section of content to render as menu
# You can also set value to "*" to render all sections to menu
BookSection = 'docs'
@ -241,16 +200,16 @@ You can specify additional params in the front matter of individual pages:
# Set type to 'docs' if you want to render page outside of configured section or if you render section other than 'docs'
type = 'docs'
# Set page weight to re-arrange items in file-tree menu (if BookMenuBundle not set)
# Set page weight to re-arrange items in file-tree menu.
weight = 10
# (Optional) Set to 'true' to mark page as flat section in file-tree menu (if BookMenuBundle not set)
# (Optional) Set to 'true' to mark page as flat section in file-tree menu.
bookFlatSection = false
# (Optional) Set to hide nested sections or pages at that level. Works only with file-tree menu mode
bookCollapseSection = true
# (Optional) Set true to hide page or section from side menu (if BookMenuBundle not set)
# (Optional) Set true to hide page or section from side menu.
bookHidden = false
# (Optional) Set 'false' to hide ToC from page
@ -262,7 +221,7 @@ bookComments = true
# (Optional) Set to 'false' to exclude page from search index.
bookSearchExclude = true
# (Optional) Set explicit href attribute for this page in a menu (if BookMenuBundle not set)
# (Optional) Set explicit href attribute for this page in a menu.
bookHref = ''
```

View File

@ -66,10 +66,6 @@ enableGitInfo = true
# If the logo is /static/logo.png then the path would be logo.png
# BookLogo = 'logo.png'
# (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used
# BookMenuBundle = '/menu'
# (Optional, default docs) Specify root page to render child pages as menu.
# Page is resoled by .GetPage function: https://gohugo.io/functions/getpage/
# For backward compatibility you can set '*' to render all sections to menu. Acts same as '/'

View File

@ -62,10 +62,6 @@ params:
# If the logo is /static/logo.png then the path would be logo.png
# BookLogo: /logo.png
# (Optional, default none) Set leaf bundle to render as side menu
# When not specified file structure and weights will be used
# BookMenuBundle: /menu
# (Optional, default docs) Specify root page to render child pages as menu.
# Page is resoled by .GetPage function: https://gohugo.io/functions/getpage/
# For backward compatibility you can set '*' to render all sections to menu. Acts same as '/'

View File

@ -1,5 +0,0 @@
{{ with .Site.GetPage .Site.Params.BookMenuBundle }}
{{- $href := printf "href=\"%s\"" $.RelPermalink -}}
{{- replace .Content $href (print $href "class=active") | safeHTML -}}
{{- warnf "Bundle menu mode is deprecated and will be removed" -}}
{{ end }}

View File

@ -8,11 +8,7 @@
{{ partial "docs/inject/menu-before" . }}
{{ partial "docs/menu-hugo" .Site.Menus.before }}
{{ if .Site.Params.BookMenuBundle }}
{{ partial "docs/menu-bundle" . }}
{{ else }}
{{ partial "docs/menu-filetree" . }}
{{ end }}
{{ partial "docs/menu-filetree" . }}
{{ partial "docs/menu-hugo" .Site.Menus.after }}
{{ partial "docs/inject/menu-after" . }}