Skip to content

Commit

Permalink
docs: merge menu docs #423
Browse files Browse the repository at this point in the history
  • Loading branch information
McShelby committed Oct 24, 2024
1 parent 4190479 commit 0938e8b
Show file tree
Hide file tree
Showing 15 changed files with 90 additions and 209 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ The Relearn theme is an enhanced fork of the popular [Learn theme](https://githu
- [Chapter and site-wide printing capabilities](https://mcshelby.github.io/hugo-theme-relearn/configuration/sitemanagement/outputformats#print-support)
- [Versatile search options: in-page, popup, and dedicated search page](https://mcshelby.github.io/hugo-theme-relearn/configuration/sidebar/search)
- [Customizable top bar buttons](https://mcshelby.github.io/hugo-theme-relearn/configuration/customization/topbar)
- [Nested menus](https://mcshelby.github.io/hugo-theme-relearn/authoring/frontmatter/menu)
- [Configurable menus](https://mcshelby.github.io/hugo-theme-relearn/configuration/sidebar/shortcutmenu)
- [Configurable menus](https://mcshelby.github.io/hugo-theme-relearn/configuration/sidebar/menus)
- [Support for hidden pages](https://mcshelby.github.io/hugo-theme-relearn/configuration/content/hidden)
- [Comprehensive taxonomy support](https://mcshelby.github.io/hugo-theme-relearn/configuration/customization/taxonomy)
- [Social media integration](https://mcshelby.github.io/hugo-theme-relearn/configuration/sitemanagement/meta#social-media-images)
Expand Down
9 changes: 0 additions & 9 deletions exampleSite/content/authoring/frontmatter/menu/_index.pir.md

This file was deleted.

9 changes: 9 additions & 0 deletions exampleSite/content/authoring/frontmatter/menus/_index.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
+++
description = "Setting the behavior of the menus"
title = "Menus"
weight = 2
+++

The theme can build menu trees from [the structure of your page files](authoring/structure) or from [Hugo's build in menu feature](https://gohugo.io/content-management/menus/).

To keep all documentation for menus together, you can [find it in the configureation section](configuration/sidebar/menus).
6 changes: 6 additions & 0 deletions exampleSite/content/authoring/frontmatter/menus/_index.pir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
+++
description = "Setting the behavior of the menus"
title = "Menus"
weight = 2
+++
{{< piratify >}}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
+++
categories = ["howto"]
description = "Setting the behavior of the menus"
description = "Configure all things menus"
frontmatter = ["alwaysopen", "collapsibleMenu", "linkTitle", "menuPost", "menuPre", "ordersectionsby", "sidebarmenus"]
options = ["alwaysopen", "collapsibleMenu", "ordersectionsby", "sidebarmenus"]
options = ["alwaysopen", "collapsibleMenu", "disableShortcutsTitle", "ordersectionsby", "sidebarmenus"]
title = "Menus"
weight = 2
weight = 4
+++

The theme can build menu trees from [the structure of your page files](authoring/structure) or from [Hugo's build in menu feature](https://gohugo.io/content-management/menus/).
Expand Down Expand Up @@ -124,6 +124,8 @@ For this, open `content/first-chapter/first-page/_index.md` and add the followin

Just don't give your parent menu entry configuration a `url` or `pageRef`. See the [next section](#title-for-menus) for a special case.

If you want to learn how to configure different Hugo menus for each language, [see the official docs](https://gohugo.io/content-management/multilingual/#menus).

{{< multiconfig fm=true >}}
[[menu.addendum]]
name = 'Parent 1'
Expand Down Expand Up @@ -156,6 +158,8 @@ If you don't want to fiddle around with your translation files, you also have th

In this case, the `title` or `name` is taken for the menu heading.

If you want to learn how to configure different Hugo menus for each language, [see the official docs](https://gohugo.io/content-management/multilingual/#menus).

{{< multiconfig fm=true >}}
[[menu.addendum]]
name = 'A Menu Title for the Whole Menu'
Expand All @@ -173,6 +177,24 @@ In this case, the `title` or `name` is taken for the menu heading.
weight = 2
{{< /multiconfig >}}

## Title for the Predefined Shortcut Menu

{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} By default, the predefined shortcut menu has a the title _More_ (in the English translation).

You can disable this title with `disableShortcutsTitle=true`.

{{< multiconfig file=hugo >}}
[params]
disableShortcutsTitle = true
{{< /multiconfig >}}

To change the title, override your translation file.

````toml {title="i18n/en.toml"}
[shortcuts-menuTitle]
other = "Other Great Stuff"
````

## Defining Sidebar Menus

{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} {{% badge style="green" icon="fa-fw fab fa-markdown" title=" " %}}Front Matter{{% /badge %}} Menus are defined using the `sidebarmenus` option.
Expand All @@ -181,8 +203,8 @@ You can define as many menus, as you like. If you don't overwrite this option, t

{{< multiconfig >}}
sidebarmenus = [
{ type = 'page', identifier = 'home', main = true, disableTitle = true, pageRef = '' },
{ type = 'menu', identifier = 'shortcuts', main = false, disableTitle = false },
{ type = 'page', identifier = 'home', main = true, disableTitle = true, pageRef = '' },
{ type = 'menu', identifier = 'shortcuts', main = false, disableTitle = false },
]
{{< /multiconfig >}}

Expand Down Expand Up @@ -238,3 +260,32 @@ title = 'Documentation'
{ type = 'page', identifier = 'docs', pageRef = '/docs' },
]
{{< /multiconfig >}}

## Displaying Pages Exclusively in a Hugo Menu

Sometimes you want to hide pages from the page menu but instead want to show them in a Hugo menu. For that you have two choices

1. Create a [headless branch bundle](https://gohugo.io/content-management/page-bundles/#headless-bundle), `_index.md` in its own folder with the below front matter. The branch bundle will **not** be contained in the sitemap.

{{< multiconfig fm=true file="content/showcase/_index.en.md" >}}
title = 'Showcase'
[_build]
render = 'always'
list = 'never'
publishResources = true
{{< /multiconfig >}}

2. Or, put a child page _inside_ a headless branch bundle with the following front matter in the bundle. This causes the child but not the branch bundle to be contained in the sitemap.

{{< multiconfig fm=true file="content/more/_index.en.md" >}}
[_build]
render = 'never'
list = 'never'
publishResources = false
{{< /multiconfig >}}

The child page can be any type of content.

{{< multiconfig fm=true file="content/more/credits_index.en.md" >}}
title = 'Credits'
{{< /multiconfig >}}
9 changes: 9 additions & 0 deletions exampleSite/content/configuration/sidebar/menus/_index.pir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
+++
categories = ["howto"]
description = "Configure all things menus"
frontmatter = ["alwaysopen", "collapsibleMenu", "linkTitle", "menuPost", "menuPre", "ordersectionsby", "sidebarmenus"]
options = ["alwaysopen", "collapsibleMenu", "disableShortcutsTitle", "ordersectionsby", "sidebarmenus"]
title = "Menus"
weight = 4
+++
{{< piratify >}}
176 changes: 0 additions & 176 deletions exampleSite/content/configuration/sidebar/shortcutmenu/_index.en.md

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion exampleSite/content/introduction/releasenotes/2/0.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ weight = -0

### New

- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} You can define the expansion state of your menus in the front matter. Please see further [documentation](authoring/frontmatter/menu#expand-state-of-submenus) for possible values and default behavior.
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} You can define the expansion state of your menus in the front matter. Please see further [documentation](configuration/sidebar/menus#expand-state-of-submenus) for possible values and default behavior.

- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} New partials for defining pre/post content for menu items and the content. See [documentation](configuration/customization/partials) for further reading.

Expand Down
2 changes: 1 addition & 1 deletion exampleSite/content/introduction/releasenotes/2/4.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ weight = -4

- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Hidden pages are displayed by default in their according tags page. You can now turn off this behavior by setting `disableTagHiddenPages=true` in your `hugo.toml`.

- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} You can define the expansion state of your menus for the whole site by setting the `alwaysopen` option in your `hugo.toml`. Please see further [documentation](authoring/frontmatter/menu#expand-state-of-submenus) for possible values and default behavior.
- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} You can define the expansion state of your menus for the whole site by setting the `alwaysopen` option in your `hugo.toml`. Please see further [documentation](configuration/sidebar/menus#expand-state-of-submenus) for possible values and default behavior.

- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} New front matter `ordersectionsby` option to change immediate children sorting in menu and `children` shortcode. Possible values are `title` or `weight`.

Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/introduction/releasenotes/5/22.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ weight = -22

- {{% badge style="note" title=" " %}}Change{{% /badge %}} You can now have structural sections in the hierarchical menu without generating a page for it.

This can come in handy, if content for such a section page doesn't make much sense to you. See [the documentation](authoring/frontmatter/menu#disable-menu-entries) for how to do this.
This can come in handy, if content for such a section page doesn't make much sense to you. See [the documentation](configuration/sidebar/menus#disable-menu-entries) for how to do this.

This feature may require you to make changes to your existing installation if you are already using _[shortcuts to pages inside of your project](configuration/sidebar/shortcutmenu#displaying-pages-only-in-the-shortcuts-menu)_ with a _headless branch parent_.
This feature may require you to make changes to your existing installation if you are already using _[shortcuts to pages inside of your project](configuration/sidebar/menus#displaying-pages-exclusively-in-a-hugo-menu)_ with a _headless branch parent_.

In this case it is advised to remove the `title` from the headless branch parent's front matter, as it will otherwise appear in your breadcrumbs.

Expand Down
2 changes: 1 addition & 1 deletion exampleSite/content/introduction/releasenotes/5/9.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ weight = -9

It was later discovered, that this causes pages only meant to be displayed in the `More` section of the menu and stored directly inside your `content` directory to now show up in the menu as well.

To [get rid](configuration/sidebar/shortcutmenu#displaying-pages-only-in-the-shortcuts-menu) of this undesired behavior you have two choices:
To [get rid](configuration/sidebar/menus#displaying-pages-exclusively-in-a-hugo-menu) of this undesired behavior you have two choices:

1. Make the page file a [headless branch bundle](https://gohugo.io/content-management/page-bundles/#headless-bundle) (contained in its own subdirectory and called `_index.md`) and add the following front matter configuration to the file (see exampleSite's `content/showcase/_index.en.md`). This causes its content to **not** be ontained in the sitemap.

Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/introduction/releasenotes/7/0.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ weight = -0
- suffered from poor build performance for sites with 1000 or more pages
- reinvented the wheel instead of using available Hugo mechanisms

_What do I gain_, you may ask. A significant performance boost during build! Usually, the build time has been cut at least in half for bigger sites. It is now possible to build even larger sites with 5000 or more pages. This was previously almost impossible due to rapidly increasing build time with the more pages you've introduced. For even bigger sites, the theme now has [configurable performance optimizations](authoring/frontmatter/menu#expander-for-submenus) - at the price of feature limitations.
_What do I gain_, you may ask. A significant performance boost during build! Usually, the build time has been cut at least in half for bigger sites. It is now possible to build even larger sites with 5000 or more pages. This was previously almost impossible due to rapidly increasing build time with the more pages you've introduced. For even bigger sites, the theme now has [configurable performance optimizations](configuration/sidebar/menus#expander-for-submenus) - at the price of feature limitations.

If you haven't done customizations to any partials, you can update right away.

Expand Down Expand Up @@ -90,7 +90,7 @@ weight = -0
Also, a lot of previously undocumented features are now included, namely

- the [hidden pages](configuration/content/hidden) feature
- options of the [navigation menu](authoring/frontmatter/menu)
- [options of the menus](configuration/sidebar/menus)
- configuring [breadcrumb, titles](configuration/content/titles) and [headings](configuration/content/headings) of your content
- [options for using links](configuration/content/linking)
- adding [custom output formats](configuration/customization/outputformats)
Loading

0 comments on commit 0938e8b

Please sign in to comment.