2021-08-25 13:33:29 +02:00
+++
2024-09-29 23:48:56 +02:00
description = "Add additional shortcut links to the sidebar"
2024-10-05 01:49:00 +02:00
options = ["disableShortcutsTitle"]
2024-09-29 23:48:56 +02:00
title = "Shortcut Menu"
2024-09-21 13:05:58 +02:00
weight = 5
2021-08-25 13:33:29 +02:00
+++
2017-08-20 17:10:29 +02:00
2024-09-29 23:48:56 +02:00
The sidebar contains the navigation menu of your content files but you can also add additional menu entries or shortcuts below the navigation menu.
2017-08-20 17:10:29 +02:00
2024-10-06 16:19:13 +02:00
Be sure to use the `pageRef` property instead of `url` for all links internal to your site. You can read more about [Hugo's menu configuration ](https://gohugo.io/content-management/menus/#define-in-site-configuration ) in its documenation.
2017-08-20 17:10:29 +02:00
2024-09-29 23:48:56 +02:00
## Title
2017-08-20 17:10:29 +02:00
2024-10-06 16:19:13 +02:00
By default, the shortcut menu is preceded by a title ("_More_" in the english translation). This title can be disabled by setting `params.disableShortcutsTitle=true` . However, if you want to keep the title but change its value, it can be overridden by changing your local i18n translation string configuration.
2024-09-29 23:48:56 +02:00
For example, in your local `i18n/en.toml` file, add the following content
````toml {title="en.toml"}
[Shortcuts-Title]
other = "Other Great Stuff"
````
## Single Language Example
Edit the `hugo.toml` and add a `[[menu.shortcuts]]` entry for each link your want to add.
2017-08-20 17:10:29 +02:00
2024-03-02 11:04:52 +01:00
{{< multiconfig file = hugo > }}
2021-08-24 00:25:15 +02:00
[[menu.shortcuts]]
2024-10-06 16:19:13 +02:00
name = "< i class = 'fa-fw fab fa-github' > < / i > GitHub repo"
identifier = "ds"
url = "https://github.com/McShelby/hugo-theme-relearn"
weight = 10
2021-08-24 00:25:15 +02:00
[[menu.shortcuts]]
2024-10-06 16:19:13 +02:00
name = "< i class = 'fa-fw fas fa-camera' > < / i > Showcases"
pageRef = "/showcase"
weight = 11
2021-08-24 00:25:15 +02:00
[[menu.shortcuts]]
2024-10-06 16:19:13 +02:00
name = "< i class = 'fa-fw fas fa-bookmark' > < / i > Hugo Documentation"
identifier = "hugodoc"
url = "https://gohugo.io/"
weight = 20
2021-08-24 00:25:15 +02:00
[[menu.shortcuts]]
2024-10-06 16:19:13 +02:00
name = "< i class = 'fa-fw fas fa-bullhorn' > < / i > Credits"
pageRef = "/more/credits"
weight = 30
2021-10-24 11:53:09 +02:00
[[menu.shortcuts]]
2024-10-06 16:19:13 +02:00
name = "< i class = 'fa-fw fas fa-tags' > < / i > Tags"
pageRef = "/tags"
weight = 40
2024-03-02 11:04:52 +01:00
{{< / multiconfig > }}
2017-08-20 17:10:29 +02:00
2024-09-29 23:48:56 +02:00
## Multilingual Example
2017-08-20 17:10:29 +02:00
2023-11-30 00:14:22 +01:00
When using a multilingual website, you can set different menus for each language. In the `hugo.toml` file, prefix your menu configuration by `Languages.<language-id>` .
2017-08-20 17:10:29 +02:00
2024-03-02 11:04:52 +01:00
{{< multiconfig file = hugo > }}
2023-05-17 20:58:37 +02:00
[languages]
[languages.en]
2022-02-24 23:09:49 +01:00
title = "Hugo Relearn Theme"
2021-10-24 11:53:09 +02:00
weight = 1
languageName = "English"
2023-05-17 20:58:37 +02:00
[languages.en.params]
2024-03-18 17:24:06 +01:00
landingPageName = "< i class = 'fa-fw fas fa-home' > < / i > Home"
2021-10-24 11:53:09 +02:00
2023-05-17 20:58:37 +02:00
[[languages.en.menu.shortcuts]]
2024-03-18 17:24:06 +01:00
name = "< i class = 'fa-fw fab fa-github' > < / i > GitHub repo"
2021-10-24 11:53:09 +02:00
identifier = "ds"
url = "https://github.com/McShelby/hugo-theme-relearn"
weight = 10
2023-05-17 20:58:37 +02:00
[[languages.en.menu.shortcuts]]
2024-03-18 17:24:06 +01:00
name = "< i class = 'fa-fw fas fa-camera' > < / i > Showcases"
2024-10-06 16:19:13 +02:00
pageRef = "/showcase"
2021-10-24 11:53:09 +02:00
weight = 11
2023-05-17 20:58:37 +02:00
[[languages.en.menu.shortcuts]]
2024-03-18 17:24:06 +01:00
name = "< i class = 'fa-fw fas fa-bookmark' > < / i > Hugo Documentation"
2021-10-24 11:53:09 +02:00
identifier = "hugodoc"
url = "https://gohugo.io/"
weight = 20
2023-05-17 20:58:37 +02:00
[[languages.en.menu.shortcuts]]
2024-03-18 17:24:06 +01:00
name = "< i class = 'fa-fw fas fa-bullhorn' > < / i > Credits"
2024-10-06 16:19:13 +02:00
pageRef = "/more/credits"
2021-10-24 11:53:09 +02:00
weight = 30
2023-05-17 20:58:37 +02:00
[[languages.en.menu.shortcuts]]
2024-03-18 17:24:06 +01:00
name = "< i class = 'fa-fw fas fa-tags' > < / i > Tags"
2024-10-06 16:19:13 +02:00
pageRef = "/tags"
2021-10-24 11:53:09 +02:00
weight = 40
2023-05-17 20:58:37 +02:00
[languages.pir]
2022-02-24 23:09:49 +01:00
title = "Cap'n Hugo Relearrrn Theme"
2021-10-24 11:53:09 +02:00
weight = 1
2024-09-29 23:57:23 +02:00
languageName = "Arrr! Pirrratish"
2023-05-17 20:58:37 +02:00
[languages.pir.params]
2024-03-18 17:24:06 +01:00
landingPageName = "< i class = 'fa-fw fas fa-home' > < / i > Arrr! Home"
2021-10-24 11:53:09 +02:00
2023-05-17 20:58:37 +02:00
[[languages.pir.menu.shortcuts]]
2024-03-18 17:24:06 +01:00
name = "< i class = 'fa-fw fab fa-github' > < / i > GitHub repo"
2021-10-24 11:53:09 +02:00
identifier = "ds"
url = "https://github.com/McShelby/hugo-theme-relearn"
weight = 10
2023-05-17 20:58:37 +02:00
[[languages.pir.menu.shortcuts]]
2024-03-18 17:24:06 +01:00
name = "< i class = 'fa-fw fas fa-camera' > < / i > Showcases"
2024-10-06 16:19:13 +02:00
pageRef = "/showcase"
2021-10-24 11:53:09 +02:00
weight = 11
2023-05-17 20:58:37 +02:00
[[languages.pir.menu.shortcuts]]
2024-03-18 17:24:06 +01:00
name = "< i class = 'fa-fw fas fa-bookmark' > < / i > Cap'n Hugo Documentat'n"
2021-10-24 11:53:09 +02:00
identifier = "hugodoc"
url = "https://gohugo.io/"
weight = 20
2023-05-17 20:58:37 +02:00
[[languages.pir.menu.shortcuts]]
2024-03-18 17:24:06 +01:00
name = "< i class = 'fa-fw fas fa-bullhorn' > < / i > Crrredits"
2024-10-06 16:19:13 +02:00
pageRef = "/more/credits"
2021-10-24 11:53:09 +02:00
weight = 30
2023-05-17 20:58:37 +02:00
[[languages.pir.menu.shortcuts]]
2024-03-18 17:24:06 +01:00
name = "< i class = 'fa-fw fas fa-tags' > < / i > Arrr! Tags"
2024-10-06 16:19:13 +02:00
pageRef = "/tags"
2021-10-24 11:53:09 +02:00
weight = 40
2024-03-02 11:04:52 +01:00
{{< / multiconfig > }}
2017-08-20 17:10:29 +02:00
2024-10-06 16:19:13 +02:00
## How to Display Pages Only in the Shortcuts Menu
2023-05-19 22:33:27 +02:00
2024-09-29 23:48:56 +02:00
If you have shortcuts to pages inside of your project and you don't want them to show up in your navigation menu, you have two choices:
2023-05-19 22:33:27 +02:00
2024-09-29 23:48:56 +02:00
1. Make the page file for the shortcut 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 frontmatter configuration to the file (see exampleSite's `content/showcase/_index.en.md` ). This causes its content to **not** be contained in the sitemap.
2023-05-19 22:33:27 +02:00
2024-03-02 11:04:52 +01:00
{{< multiconfig fm = true > }}
2023-09-21 17:23:41 +02:00
title = "Showcase"
2023-05-19 22:33:27 +02:00
[_build]
2023-09-21 17:23:41 +02:00
render = "always"
2023-05-19 22:33:27 +02:00
list = "never"
2023-09-21 17:23:41 +02:00
publishResources = true
2024-03-02 11:04:52 +01:00
{{< / multiconfig > }}
2023-05-19 22:33:27 +02:00
2024-03-02 14:19:46 +01:00
2. Store the page file for the shortcut below a parent headless branch bundle and add the following frontmatter to he **parent** (see exampleSite's `content/more/_index.en.md` ). **Don't give this page a `title`** as this will cause it to be shown in the breadcrumbs - a thing you most likely don't want.
2023-05-19 22:33:27 +02:00
2024-03-02 11:04:52 +01:00
{{< multiconfig fm = true > }}
2023-05-19 22:33:27 +02:00
[_build]
2023-09-21 17:23:41 +02:00
render = "never"
2023-05-19 22:33:27 +02:00
list = "never"
2023-09-21 17:23:41 +02:00
publishResources = false
2024-03-02 11:04:52 +01:00
{{< / multiconfig > }}
2023-09-21 17:23:41 +02:00
In this case, the file itself can be a branch bundle, leaf bundle or simple page (see exampleSite's `content/more/credits.en.md` ). This causes its content to be contained in the sitemap.
2024-03-02 11:04:52 +01:00
{{< multiconfig fm = true > }}
2023-09-21 17:23:41 +02:00
title = "Credits"
2024-03-02 11:04:52 +01:00
{{< / multiconfig > }}