hugo-book
hugo-book copied to clipboard
Using .LinkTitle in file tree menu
Hello, I'm not sure about this, but I think I've found a slight misalignment with the Hugo spec. So Hugo's front matter documentation says:
linkTitle: used for creating links to content; if set, Hugo defaults to using the
linktitle
before thetitle
. Hugo can also order lists of content bylinktitle
.
However, linkTitle
currently seems to be ignored in this theme's file tree menu and other spots. I think having this would be nice; the title on the page itself can be very long, whereas a long title looks kind of crazy in the file tree menu.
I believe the fix is to:
- Create a new partial specifically for cases where a title is meant as a link, e.g.:
docs/linktitle.html
- This partial would look exactly the same as
docs/title.html
except with an extra if case:{{ if .LinkTitle }} {{ $title = .LinkTitle }} {{ else if .Title }} {{ $title = .Title }} ...
- Go through each call to
docs/title.html
and repoint it to the new partial if the title is being used in a link.
Does this seem like a reasonable solution to you? If so, I'd be happy to submit a pull request (I am not very familiar with open source, so I thought it best to raise this issue before doing so). Thanks - this is a really great theme, by the way!
Hi!
Sounds ok, we can change ref to .LinkTitle
. Shoulb be backward compatible as far as I can tell.