Search code examples
typo3categoriesfluidtypo3-8.xtx-news

TYPO3 write name of sys_category into class name at tx_news


I'using TYPO3 8.7 and write the name of a sys_categoryinto the class name of tx_news-template Item.html, like this:

<div class="{f:format.case(value: '{newsItem.firstCategory.title}', mode: 'lower')}"> ...

Now one of my categories has two words, like 'my category', so the classname results:

<div class="my category">

How can I remove the empty ' ' from class name in FLUID?

Thanks for your help.


Solution

  • Also i would think about using the category uid instead of category name. As names are brittle. An editor might rename somthing and your css code breaks. But your pretty save if you use uids