Reputation: 1
Whats the best way to have a Field "Navigation Title" in Neos?
I'd like to get a field to "overwrite" PageTitle with a shorter Version used in the Navigation-Menu.
Im loooking for the same function Typo3 offers with their field "navigation title".
Example:
I want the long Title in <title>
etc, but i prefer a short-title in the navigation menu.
Page Title: "Pretty long and nice Page-Title about the Page Communication"
Navigation Title: "Communication"
Upvotes: 0
Views: 128
Reputation: 11
There is the Neos.Seo package which adds this functionality and further SEO features like Meta tags, Sitemap, Social tags, Structured data. The additional field added to the document properties is named titleOverride
.
If you use this package you can just use the included fusion prototype to handle the title tag:
prototype(Neos.Neos:Page) {
head {
titleTag >
titleTag = Neos.Seo:TitleTag
}
}
Upvotes: 0
Reputation: 41
I'd add it as a property to your page type (or to Neos.Neos:Document
). The MenuImplementation
of the default Fusion Menu
object uses the "label" of the page type, so you can just set it so it uses your custom navigationTitle property.
So you'd have this:
'Neos.Neos:Document':
label: "${String.cropAtWord(String.trim(String.stripTags(String.pregReplace(q(node).property('navigationTitle') || q(node).property('title') ... [all the rest of the default label]"
The default label can be seen in the NodeTypes.yaml
file under ./Packages/Application/Neos.Neos/Configuration
, so you can copy it from there and add your navigationTitle to it.
[edit: the line-break after "label:" is added by StackOverflow - there shouldn't actually be one in your YAML.]
Upvotes: 1