hermit
hermit copied to clipboard
Feature request: menu shortnames
Issue:
The menus can be large multi-word text. Therefore in the mobile view they get bloated and even very large.
Suggestion:
I would like to propose that we have a tag under the [[menu.main]]
in the config.toml
to have also short name for the sections.
[menu]
[[menu.main]]
name = "Blog Posts"
shortname = "Posts"
url = "posts/"
weight = 10
P.s: I have just started with Hugo and I'm new to it. I tried to modify the layouts/partials/
to have another file named menu-short.html
but I got the following error:
{{- range .Site.Menus.main }}
{{- if .HasChildren }}
<a href="{{ .URL | absLangURL }}" class="has-children">{{ .shortname }}</a>
<span class="sub-menu">
{{- range .Children }}
<a href="{{ .URL | absLangURL }}">{{ .shortname }}</a>
{{- end }}
</span>
{{- else }}
<a href="{{ .URL | absLangURL }}">{{ .shortname }}</a>
{{- end }}
{{- end }}
Rebuild failed:
Failed to render pages: render of "section" failed: execute of template failed: template: _default/list.html:2:3: executing "header" at <partialCached "header.html" .>: error calling partialCached: "/Users/mehrad/Documents/Personal Projects/Personal CV/PersonalSite/themes/hermit/layouts/partials/header.html:10:41": execute of template failed: template: partials/header.html:9:8: executing "partials/header.html" at <partialCached "menu-short.html" .>: error calling partialCached: "/Users/mehrad/Documents/Personal Projects/Personal CV/PersonalSite/themes/hermit/layouts/partials/menu-short.html:10:41": execute of template failed: template: partials/menu-short.html:10:41: executing "partials/menu-short.html" at <.ShortName>: can't evaluate field ShortName in type *navigation.MenuEntry
Maybe Hugo just doesn't allow using other string for menu configs. I'm not sure about this as my understanding about Hugo is very limited. I would suggest you seek help at the official forum.