Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: menu shortnames #79

Open
mmahmoudian opened this issue Jun 28, 2019 · 1 comment
Open

Feature request: menu shortnames #79

mmahmoudian opened this issue Jun 28, 2019 · 1 comment

Comments

@mmahmoudian
Copy link

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

@Track3
Copy link
Owner

Track3 commented Jul 4, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants