Skip to content

Commit

Permalink
Remove deprecated bundle/leaf menu type
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-shpak committed Oct 2, 2024
1 parent 2f64607 commit 3166253
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 64 deletions.
51 changes: 5 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand All @@ -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 = ''
```

Expand Down
4 changes: 0 additions & 4 deletions exampleSite/hugo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 '/'
Expand Down
4 changes: 0 additions & 4 deletions exampleSite/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 '/'
Expand Down
5 changes: 0 additions & 5 deletions layouts/partials/docs/menu-bundle.html

This file was deleted.

6 changes: 1 addition & 5 deletions layouts/partials/docs/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -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" . }}
Expand Down

0 comments on commit 3166253

Please sign in to comment.