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

(MAINT) Respect LinkTitle in page metadata #483

Conversation

michaeltlombardi
Copy link
Contributor

Prior to this commit, the partial for determining a page title used the Title property of a page, if present, or humanized and titleized the file name if not.

It did not use the LinkTitle property at all (defined in the front matter). According to the menu documentation:

The following order is used to determine an Identifier:

.Name > .LinkTitle > .Title

This means that .Title will be used unless `.LinkTitle is present, etc.

Similar, the documentation for menu entry variables states:

The name key, if set for the menu entry, sets this value. If that key is not set, and if the menu entry is set in a page front-matter, this value defaults to the page's .LinkTitle.

Together, these imply that if .LinkTitle is specified, it should be preferred over .Title for the generated nav menu.

Prior to this commit, the partial for determining a page title used the
`Title` property of a page, if present, or humanized and titleized the
file name if not.

It did not use the `LinkTitle` property at all (defined in the
[front matter][01]). According to the [menu documentation][02]:

> The following order is used to determine an Identifier:
>
> `.Name > .LinkTitle > .Title`
>
> This means that `.Title` will be used unless `.LinkTitle is present,
> etc.

Similar, the documentation for [menu entry variables][03] states:

> The `name` key, if set for the menu entry, sets this value. If that
> key is not set, and if the menu entry is set in a page front-matter,
> this value defaults to the page's `.LinkTitle`.

Together, these imply that if `.LinkTitle` is specified, it should be
preferred over `.Title` for the generated nav menu.

[01]: https://gohugo.io/content-management/front-matter/
[02]: https://gohugo.io/content-management/menus/#nesting
[03]: https://gohugo.io/variables/menus/#menu-entry-variables
@michaeltlombardi
Copy link
Contributor Author

Related to #476.

@alex-shpak
Copy link
Owner

👍 Thank you!

@alex-shpak alex-shpak merged commit 6090fdd into alex-shpak:master Oct 5, 2022
@michaeltlombardi michaeltlombardi deleted the maint/master/respect-linktitle branch October 5, 2022 12:08
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

Successfully merging this pull request may close these issues.

None yet

2 participants