Skip to content

Commit 7a8ddde

Browse files
committed
[TASK] Add breadcrumb Menu
Releases: main, 13.4
1 parent 487582a commit 7a8ddde

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

Documentation/Menu/Breadcrumb.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
:navigation-title: Breadcrumb
2+
.. include:: /Includes.rst.txt
3+
4+
.. _breadcrumb:
5+
6+
=========================================
7+
Breadcrumb / rootline navigation in TYPO3
8+
=========================================
9+
10+
If you use a `Generated site package <https://docs.typo3.org/permalink/t3sitepackage:minimal-design>`_
11+
it already contains a breadcrumb navigation on the subpages.
12+
13+
To display a breadcrumb the `menu data processor <https://docs.typo3.org/permalink/t3tsref:menuprocessor>`_
14+
can be used with the special type `Rootline <https://docs.typo3.org/permalink/t3tsref:hmenu-special-rootline>`_.
15+
16+
.. _breadcrumb-typoscript:
17+
18+
Breadcrumb TypoScript - the data processor
19+
==========================================
20+
21+
.. literalinclude:: /CodeSnippets/my_site_package/Configuration/Sets/SitePackage/TypoScript/Navigation/breadcrumb.typoscript
22+
:caption: packages/my_site_package/Configuration/Sets/SitePackage/TypoScript/Navigation/breadcrumb.typoscript
23+
:linenos:
24+
:emphasize-lines: 6-8
25+
26+
Line 4: Each data processor must have a unique id. We used 10 for the
27+
`page-content data processor <https://docs.typo3.org/permalink/t3sitepackage:page-content-data-processor>`_
28+
and 20 for the :ref:`Main menu <main-menu-creation>` therefore we now use 30.
29+
30+
Line 6: We configure the menu to use the special type
31+
`Rootline <https://docs.typo3.org/permalink/t3tsref:hmenu-special-rootline>`_.
32+
33+
Line 7: We use the property :ref:`special.range <t3tsref:confval-hmenu-rootline-special-range>`
34+
to define that the breadcrumb should start at the root level (0) of the site and
35+
include the level of the current page (-1).
36+
37+
Line 8: As the default variable of the menu data processor `menu` is already in
38+
use for the main menu, we rename the variable to be used for the breadcrumb to
39+
`breadcrumb`.
40+
41+
.. _breadcrumb-fluid:
42+
43+
Breadcrumb navigation Fluid template
44+
====================================
45+
46+
The special type `breadcrumb` delivers the items of the rootline as an array.
47+
Therefore we can use the `For ViewHelper <f:for> <https://docs.typo3.org/permalink/t3viewhelper:typo3fluid-fluid-for>`_
48+
to loop through these elements:
49+
50+
.. literalinclude:: /CodeSnippets/my_site_package/Resources/Private/PageView/Partials/Navigation/Breadcrumb.html
51+
:caption: packages/my_site_package/Resources/Private/PageView/Partials/Navigation/Breadcrumb.html
52+
:linenos:
53+
54+
55+
Line 1, 5: The data of the breadcrumb navigation can be found in variable
56+
`{breadcrumb}`. We defined this in line 8 of the :ref:`TypoScript <breadcrumb-typoscript>`.
57+
58+
Line 6: As all items in the breadcrumb navigation are in the rootline of the
59+
current page all are marked as `active`. We therefore check if the page of the
60+
entry to be displayed is the `current` page.

Documentation/Menu/Index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ breadcrumbs and sitemaps in TYPO3.
1212

1313
.. contents::
1414

15+
.. toctree::
16+
:glob:
17+
:hidden:
18+
19+
*
20+
1521
.. _menu-content-element:
1622

1723
Menus as content elements

0 commit comments

Comments
 (0)