hugo-theme-relearn/exampleSite/content/configuration/sidebar/shortcutmenu/_index.en.md

163 lines
4.6 KiB
Markdown
Raw Normal View History

+++
2024-10-12 17:28:28 +00:00
categories = ["howto"]
2024-09-29 21:48:56 +00:00
description = "Add additional shortcut links to the sidebar"
options = ["disableShortcutsTitle"]
2024-09-29 21:48:56 +00:00
title = "Shortcut Menu"
2024-10-12 16:44:36 +00:00
weight = 4
+++
2017-08-20 15:10:29 +00:00
2024-10-07 13:30:53 +00:00
The sidebar contains your content's navigation menu, but you can also add extra menu entries or shortcuts in a separate section.
2017-08-20 15:10:29 +00:00
2024-10-07 13:30:53 +00:00
For internal links, use the `pageRef` property instead of `url`. Learn more about [Hugo's menu configuration](https://gohugo.io/content-management/menus/#define-in-site-configuration).
2017-08-20 15:10:29 +00:00
2024-09-29 21:48:56 +00:00
## Title
2017-08-20 15:10:29 +00:00
2024-10-07 13:30:53 +00:00
{{% badge style="cyan" icon="gears" title=" " %}}Option{{% /badge %}} By default, the shortcut menu has a title ("_More_" in English).
2024-09-29 21:48:56 +00:00
2024-10-07 13:30:53 +00:00
You can disable this title with `disableShortcutsTitle=true`.
2024-09-29 21:48:56 +00:00
2024-10-07 13:30:53 +00:00
{{< multiconfig file=hugo >}}
[params]
disableShortcutsTitle = true
{{< /multiconfig >}}
To change the title, update your local i18n translation file.
````toml {title="i18n/en.toml"}
2024-09-29 21:48:56 +00:00
[Shortcuts-Title]
other = "Other Great Stuff"
````
## Single Language Example
2024-10-07 13:30:53 +00:00
Edit `hugo.toml` and add `[[menu.shortcuts]]` entries for each link:
2017-08-20 15:10:29 +00:00
2024-03-02 10:04:52 +00:00
{{< multiconfig file=hugo >}}
[[menu.shortcuts]]
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
identifier = 'ds'
url = 'https://github.com/McShelby/hugo-theme-relearn'
2024-10-06 14:19:13 +00:00
weight = 10
[[menu.shortcuts]]
name = '<i class="fa-fw fas fa-camera"></i> Showcases'
pageRef = '/showcase'
2024-10-06 14:19:13 +00:00
weight = 11
[[menu.shortcuts]]
name = '<i class="fa-fw fas fa-bookmark"></i> Hugo Documentation'
identifier = 'hugodoc'
url = 'https://gohugo.io/'
2024-10-06 14:19:13 +00:00
weight = 20
[[menu.shortcuts]]
name = '<i class="fa-fw fas fa-bullhorn"></i> Credits'
pageRef = '/more/credits'
2024-10-06 14:19:13 +00:00
weight = 30
2021-10-24 09:53:09 +00:00
[[menu.shortcuts]]
name = '<i class="fa-fw fas fa-tags"></i> Tags'
pageRef = '/tags'
2024-10-06 14:19:13 +00:00
weight = 40
2024-03-02 10:04:52 +00:00
{{< /multiconfig >}}
2017-08-20 15:10:29 +00:00
2024-09-29 21:48:56 +00:00
## Multilingual Example
2017-08-20 15:10:29 +00:00
2024-10-07 13:30:53 +00:00
For multilingual sites, set different menus for each language in `hugo.toml`:
2017-08-20 15:10:29 +00:00
2024-03-02 10:04:52 +00:00
{{< multiconfig file=hugo >}}
[languages]
[languages.en]
title = 'Hugo Relearn Theme'
2021-10-24 09:53:09 +00:00
weight = 1
languageName = 'English'
2021-10-24 09:53:09 +00:00
[[languages.en.menu.shortcuts]]
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
identifier = 'ds'
url = 'https://github.com/McShelby/hugo-theme-relearn'
2021-10-24 09:53:09 +00:00
weight = 10
[[languages.en.menu.shortcuts]]
name = '<i class="fa-fw fas fa-camera"></i> Showcases'
pageRef = '/showcase'
2021-10-24 09:53:09 +00:00
weight = 11
[[languages.en.menu.shortcuts]]
name = '<i class="fa-fw fas fa-bookmark"></i> Hugo Documentation'
identifier = 'hugodoc'
url = 'https://gohugo.io/'
2021-10-24 09:53:09 +00:00
weight = 20
[[languages.en.menu.shortcuts]]
name = '<i class="fa-fw fas fa-bullhorn"></i> Credits'
pageRef = '/more/credits'
2021-10-24 09:53:09 +00:00
weight = 30
[[languages.en.menu.shortcuts]]
name = '<i class="fa-fw fas fa-tags"></i> Tags'
pageRef = '/tags'
2021-10-24 09:53:09 +00:00
weight = 40
[languages.pir]
title = 'Captain Hugo Relearrrn Theme'
2024-10-07 13:30:53 +00:00
weight = 2
languageName = 'Arrr! Pirrratish'
2021-10-24 09:53:09 +00:00
[[languages.pir.menu.shortcuts]]
name = '<i class="fa-fw fab fa-github"></i> GitHub Repo'
identifier = 'ds'
url = 'https://github.com/McShelby/hugo-theme-relearn'
2021-10-24 09:53:09 +00:00
weight = 10
[[languages.pir.menu.shortcuts]]
name = '<i class="fa-fw fas fa-camera"></i> Showcases'
pageRef = '/showcase'
2021-10-24 09:53:09 +00:00
weight = 11
[[languages.pir.menu.shortcuts]]
name = '<i class="fa-fw fas fa-bookmark"></i> Captain Hugo Documentation'
identifier = 'hugodoc'
url = 'https://gohugo.io/'
2021-10-24 09:53:09 +00:00
weight = 20
[[languages.pir.menu.shortcuts]]
name = '<i class="fa-fw fas fa-bullhorn"></i> Crrredits'
pageRef = '/more/credits'
2021-10-24 09:53:09 +00:00
weight = 30
[[languages.pir.menu.shortcuts]]
name = '<i class="fa-fw fas fa-tags"></i> Arrr! Tags'
pageRef = '/tags'
2021-10-24 09:53:09 +00:00
weight = 40
2024-03-02 10:04:52 +00:00
{{< /multiconfig >}}
2017-08-20 15:10:29 +00:00
2024-10-07 13:30:53 +00:00
## Displaying Pages Only in the Shortcuts Menu
2024-10-07 13:30:53 +00:00
To show pages only in the shortcuts menu you have two choices
2024-10-07 13:30:53 +00:00
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.
2024-10-06 18:37:18 +00:00
{{< multiconfig fm=true file="content/showcase/_index.en.md" >}}
title = 'Showcase'
[_build]
render = 'always'
list = 'never'
publishResources = true
2024-03-02 10:04:52 +00:00
{{< /multiconfig >}}
2024-10-07 13:30:53 +00:00
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.
2024-10-06 18:37:18 +00:00
{{< multiconfig fm=true file="content/more/_index.en.md" >}}
[_build]
render = 'never'
list = 'never'
publishResources = false
2024-03-02 10:04:52 +00:00
{{< /multiconfig >}}
2024-10-07 13:30:53 +00:00
The child page can be any type of content.
2024-10-06 18:37:18 +00:00
{{< multiconfig fm=true file="content/more/credits_index.en.md" >}}
title = 'Credits'
2024-03-02 10:04:52 +00:00
{{< /multiconfig >}}