Generate a typolink with nav_title instead of title as link text

1.7k views Asked by At

How can I configure TYPO3 7.6 / 8.7 to use nav_title instead/before title on generating page links with fluid_styled_content?

Currently I'm using

<f:link.typolink parameter="7"></f:link.typolink>

in my fluid template. (https://fluidtypo3.org/viewhelpers/vhs/master/Link/TypolinkViewHelper.html)

This generates me a translated page link using the page.title field. I need to output the page.nav_title field there.

With css_styled_content (instead of fluid_styled_content) I could access/output the value in TS like

temp.field_title = TEXT
temp.field_title.value = nav_title // title 

(This was working similar in HMENU / TMENU ...)

1

There are 1 answers

0
derhansen On BEST ANSWER

This is intended behavior of the typolink function. The Fluid typolink viewhelper uses stdWrap to generate the link for a given content. If you do not provide any content to be "typolinked", then the typolink will always render the title of a given page uid as a fallback.

Pure TypoScript example with no content:

temp.field_title = TEXT
temp.field_title.typolink.parameter = 7

This example will render the page title of page uid 7, since no content for the TEXT is given.

In order to render the nav_title as content of the typolink viewhelper, I suggest to use the page.info viewhelper from the vhs extension.

Example:

{namespace v=FluidTYPO3\Vhs\ViewHelpers}
<f:link.typolink parameter="7">
    <v:page.info pageUid="7" field="nav_title"/>
</f:link.typolink>