From 31662538df44f65108ecc71caf48ada5b57071ff Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Wed, 2 Oct 2024 16:14:53 +0200 Subject: [PATCH] Remove deprecated bundle/leaf menu type --- README.md | 51 +++----------------------- exampleSite/hugo.toml | 4 -- exampleSite/hugo.yaml | 4 -- layouts/partials/docs/menu-bundle.html | 5 --- layouts/partials/docs/menu.html | 6 +-- 5 files changed, 6 insertions(+), 64 deletions(-) delete mode 100644 layouts/partials/docs/menu-bundle.html diff --git a/README.md b/README.md index 710ea1b..fa0c304 100644 --- a/README.md +++ b/README.md @@ -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 = '' ``` diff --git a/exampleSite/hugo.toml b/exampleSite/hugo.toml index a03c5f7..d8ac0fd 100644 --- a/exampleSite/hugo.toml +++ b/exampleSite/hugo.toml @@ -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 '/' diff --git a/exampleSite/hugo.yaml b/exampleSite/hugo.yaml index 9eea51e..65f0825 100644 --- a/exampleSite/hugo.yaml +++ b/exampleSite/hugo.yaml @@ -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 '/' diff --git a/layouts/partials/docs/menu-bundle.html b/layouts/partials/docs/menu-bundle.html deleted file mode 100644 index 9927923..0000000 --- a/layouts/partials/docs/menu-bundle.html +++ /dev/null @@ -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 }} diff --git a/layouts/partials/docs/menu.html b/layouts/partials/docs/menu.html index 8453e73..dbb2e49 100644 --- a/layouts/partials/docs/menu.html +++ b/layouts/partials/docs/menu.html @@ -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" . }}