TYPO3 Logo
News system
Release: 12.0

Loading data.

  • Introduction
    • What does it do?
    • Need Support?
    • Contribution
    • Sponsoring
  • Quick start
    • Quick installation
    • Quick configuration
    • Create some initial content
    • Quick templating in Fluid
  • Editors manual
    • News administration module
    • List module
    • Plugin
    • Records
      • News
      • Category
      • Tag
  • Tutorials
    • Best practice
      • SEO
      • View button
      • TSconfig code snippets
      • Use Routing to rewrite URLs
      • Breadcrumb menu
      • RSS feed
      • LinkHandler
      • Limit content elements
      • Integrations with TypoScript
      • Hide detail page in URL
      • Ajax based pagination
      • Cache clearing
      • Predefine values
      • ICalendar feed
    • Extend News
      • Extensions based on EXT:news
      • Extend FlexForms
      • Events
      • Hooks
      • Demands
      • Data processing
        • AddNewsToMenuProcessor
        • LanguageMenuProcessor
      • Add custom fields
      • Custom news types
    • Templates
      • Changing & editing templates
      • Bootstrap templates
      • Assorted snippets
      • ViewHelpers
      • Template selector
      • Render content elements
      • Group news records
      • Filter news by multiple categories
      • Set overwriteDemand in links
    • External tutorials
  • Administration
    • Installation
    • Configuration
    • Updating
    • Migration
      • Migration from tt_news to news
      • Migration from realurl to news with routing
  • Reference
    • Extension Configuration
    • TypoScript
      • Plugin settings
      • General settings
    • TsConfig
      • General configuration
      • Administration module
      • Plugin configuration
    • Events
    • ViewHelpers reference
      • ExcludeDisplayedNewsViewHelper
      • HeaderDataViewHelper
      • LinkViewHelper
      • MediaFactoryViewHelper
      • MetaTagViewHelper
      • PaginateBodytextViewHelper
      • RenderMediaViewHelper
      • TargetLinkViewHelper
      • TitleTagViewHelper
      • Format / NothingViewHelper
    • ChangeLog
      • 12.0.0 - 20th October 2024
      • 11.4.2 - 14th May 2024
      • 11.4.1 - 8th February 2024
      • 11.4.0 - 8th February 2024
      • 11.3.0 - 20th December 2023
      • 11.2.0 - 30th August 2023
      • 11.1.2 - 14th July 2023
      • 11.1.1 - 26th June 2023
      • 11.1.0 - 23rd June 2023
      • 11.0.0 - 9th March 2023
      • 10.0.3 - 21st November 2022
      • 10.0.2 - 27th October 2022
      • 10.0.1 - 22nd September 2022
      • 10.0.0 - 20th September 2022
      • 9.4.0 - 26th April 2022
      • 9.3.1 - 17th March 2022
      • 9.3.0 - 14th March 2022
      • 9.2.2 - 25th January 2022
      • 9.1.1 - 20th December 2021
      • 9.1.0 - 11th November 2021
      • 9.0.0 - 23th October 2021
      • 8.6.0 - 22th July 2021
      • 8.5.2 - 12th January 2021
      • 8.5.1 - 8th January 2021
      • 8.5.0 - 20th October 2020
      • 8.4.1 - 25th September 2020
      • 8.4.0 - 18th August 2020
      • 8.3.0 - 12th May 2020
      • 8.2.0 - 4th May 2020
      • 8.1.1 - 4th May 2020
      • 8.1.0 - 28th April 2020
      • 8.0.0 - 2020/21/04
      • 7.3.1 - 2019/29/08
      • 7.3.0 - 2019/28/08
      • 7.2.3 - 2019/08/06
      • 7.2.2 - 2019/08/05
      • 7.2.1 - 2019/08/04
      • 7.2.0 - 2019/04/15
      • 7.1.0 - 2019/07/03
      • 7.0.8 - 2018/06/11
      • 7.0.7 - 2018/24/10
      • 7.0.6 - 2018/08/10
      • 7.0.5 - 2018/16/05
      • 7.0.4 - 2018/16/05
      • 7.0.1 - 2018/27/04
      • 7.0.0 - 2018/26/04
      • 6.3.0 - 2018/02/01
      • 6.2.1- 2018/01/24
      • 6.2.0 - 2018/01/23
      • 6.1.1 - 2017/09/06
      • 6.1.0 - 2017/08/31
      • 6.0.0 - 2017/21/03
      • 5.3.1 - 2017/01/21
      • 5.3.1 - 2016/11/24
      • 5.3.0 - 2016/11/24
      • 5.2.0 - 2016/09/23
      • 5.1.0 - 2016/09/12
      • 5.0.0 - 2016/09/03
      • 4.3.0 - 2016/07/13
      • 4.2.1 - 2016/03/11
      • 4.2.0 - 2016/03/02
      • 4.1.0 - 2016/01/27
      • 4.0.0 - 2015/11/10
      • 3.2.6 - 2016/07/13
      • 3.2.5 - 2016/03/01
      • 3.2.4 - 2015/09/26
      • 3.2.3 - 2015/09/25
      • 3.2.1 - 2015/07/13
      • 3.2.1 - 2015/07/11
      • 3.2.0 - 2015/05/19
      • 3.1.0 - 2015/02/12
      • 3.0.1 - 2014/06/03
      • 3.0.0 - 2014/05/16
      • 2.3.0 - 2013/12/12
      • 2.2.1 - 2013/09/23
      • 2.2.0 - 2013/07/06
      • 2.1.0 - 2013/03/28
    • Known problems
  • Addons
    • EXT:numbered_pagination
    • EXT:news_administration
    • EXT:news_seo
    • EXT:news_tagsuggest
    • EXT:news_content_elements
    • EXT:news_importicsxml
    • EXT:news_category_pid_constraint
    • EXT:news_redirect_slug_change
    • EXT:news_fegroup_preview
    • EXT:news_filter
  • Sitemap
  • Index

Contributors Corner

  • View source of current document
  • How to edit
  • Edit current document on GitHub
  1. News system
  2. Tutorials
  3. Best practice
  4. Breadcrumb menu
Report issue View source How to edit Edit on GitHub

Breadcrumb menu

There are currently two suggested ways to make a breadcrumb menu containing the detail page of the current news: Based on data processing and Fluid template and based on pure TypoScript. Use the first method if you have no breadcrumb yet or your breadcrumb is already based on data processors. Use the second if your breadcrumb is already based on TypoScript and you do not wish to change it for now.

Breadcrumb based on data processing and Fluid

New in version 7.2.0

With version 7.2 a new data processor, AddNewsToMenuProcessor has been added which is useful for detail pages to add the news record as fake menu entry.

To use the data processor AddNewsToMenuProcessor add the following TypoScript to the setup section in your site package extension. We assume here that your main FLUIDTEMPLATE can be found in page.10.

page.10 = FLUIDTEMPLATE
page.10 {
    # [...] template settings
    dataProcessing {
        # [...] Other data processors
        50 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
        50 {
            as = breadcrumbMenu
            special = rootline
        }
        60 = GeorgRinger\News\DataProcessing\AddNewsToMenuProcessor
        60.menus = breadcrumbMenu
    }
}
Copied!

The property menus of the AddNewsToMenuProcessor must contain the key of the MenuProcessor containing your breadcrumb. If you You can use more then one menu here by supplying several keys as comma-separated list. For example: 60.menus = breadcrumbMenu,myOtherBreadcrumb.

The data array containing your breadcrumb will now contain an additional entry if you are on a news detail page. You can debug this data with the following Fluid snippet:

<f:debug>{breadcrumbMenu}</f:debug>
Copied!

The array will then contain something like that:

array(4 items)
   0 => array(7 items)
   1 => array(7 items)
   2 => array(7 items)
      data => array(84 items)
      title => 'All News' (17 chars)
      link => '/portal/news/' (34 chars)
      target => '' (0 chars)
      active => 1 (integer)
      current => 0 (integer)
      spacer => 0 (integer)
   3 => array(6 items)
      data => array(87 items)
      title => 'Test news' (13 chars)
      active => 1 (integer)
      current => 1 (integer)
      link => 'https://my-page.ddev.site/portal/news/articel/test-news' (101 chars)
      isNews => TRUE
Copied!

You can use code like the following in your sites Fluid template.

<div class="container">
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <f:for each="{breadcrumbMenu}" as="item" iteration="iterator">
                <li class="breadcrumb-item ">
                    <a href="{item.link}" title="{item.title}">
                        <f:if condition="{item.isNews}"><i class="fas fa-newspaper"></i></f:if>
                        {item.title}
                    </a>
                </li>
            </f:for>
        </ol>
    </nav>
</div>
Copied!

The result (using Bootstrap 5 and Fontawesome 5 Free) could use like this:

A breadcrumb containing the current news record.

Hint

I you are displaying the news on a single page that should not be displayed without a valid news record, unset the flag Page enabled in menus in the single pages page properties. This way the page alone does not appear in the breadcrumb.

See also chapter AddNewsToMenuProcessor.

Breadcrumb based on TypoScript (legacy)

If you already have a breadcrumb menu based on TypoScript in your project, you can continue to use it and add the news record to it.

lib.navigation_breadcrumb = COA
lib.navigation_breadcrumb {
    stdWrap.wrap = <ul class="breadcrumb">|</ul>

    10 = HMENU
    10 {
        special = rootline
        #special.range =  1

        1 = TMENU
        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 {
        stdWrap.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
        }
        stdWrap.wrap = <li>|</li>
        stdWrap.required = 1
    }
}
Copied!

The relevant part starts with 20 = RECORDS as this cObject renders the title of the news article.

Important

Never forget the source.intval = 1 to avoid SQL injections and the htmlSpecialChars = 1 to avoid Cross-Site Scripting. See security in TypoScript in TYPO3 Explained.

  • Previous
  • Next
Reference to the headline

Copy and freely share the link

This link target has no permanent anchor assigned. You can make a pull request on GitHub to suggest an anchor. The link below can be used, but is prone to change if the page gets moved.

Copy this link into your TYPO3 manual.

  • Home
  • Contact
  • Issues
  • Repository

Last rendered: Oct 20, 2024 19:08

© since 2010 by Georg Ringer & Contributors
  • Legal Notice
  • Privacy Policy