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

Using .LinkTitle in file tree menu #476

Closed
dcx opened this issue Aug 18, 2022 · 1 comment
Closed

Using .LinkTitle in file tree menu #476

dcx opened this issue Aug 18, 2022 · 1 comment

Comments

@dcx
Copy link

dcx commented Aug 18, 2022

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 the title. Hugo can also order lists of content by linktitle.

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:

  1. Create a new partial specifically for cases where a title is meant as a link, e.g.: docs/linktitle.html
  2. 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 }}
    ...
    
  3. 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!

@alex-shpak
Copy link
Owner

Hi!
Sounds ok, we can change ref to .LinkTitle. Shoulb be backward compatible as far as I can tell.

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