Search code examples
typo3typoscriptfluidextbasetx-news

How to set breadcrumb for tx_news TYPO3


I have a TYPO3 site. I need to set a breadcrumb. For news I need to show the news title inplace of 'News Detail' (Page title of news plugin). How to implement that?

My code is

<v:page.breadCrumb class="breadcrumb" levels="1" showCurrent="1" divider=">" showCurrent="1" entryLevel="1"/>

or any other method for getting the title like

<ol class="breadcrumb">
  <li><a href="/">Home</a></li>
  <li><a href="/news">News</a></li>
  <li class="active"> ???????? </li>
</ol>

Solution

  • Sorry but that is not possible out of the box. The news record is not a real page and therefore must be added a bit different.

    Instead of using the viewhelper, use this TS code

    lib.navigation_breadcrumb = COA
    lib.navigation_breadcrumb {
    stdWrap.wrap = <ol class="breadcrumb">|</ol>
    
    10 = HMENU
    10 {
        special = rootline
        #special.range =  1
    
        1 = TMENU
        1 {
            noBlur = 1
    
            NO = 1
            NO {
                wrapItemAndSub = <li>|</li>
                ATagTitle.field = subtitle // title
                stdWrap.htmlSpecialChars = 1
            }
    
            CUR <.NO
            CUR {
                wrapItemAndSub = <li class="active">|</li>
                doNotLinkIt = 1
            }
        }
    }
    
    # Add news title if on single view
    20 = RECORDS
    20 {
        if.isTrue.data = GP:tx_news_pi1|news
        dontCheckPid = 1
        tables = tx_news_domain_model_news
        source.data = GP:tx_news_pi1|news
        source.intval = 1
        conf.tx_news_domain_model_news = TEXT
        conf.tx_news_domain_model_news {
            field = title
            htmlSpecialChars = 1
        }
        wrap =  <li>|</li>
    }
    }
    

    And include it by using <f:cObject typoscriptObjectPath="lib.navigation_breadcrumb" />