One moment, we're cooking some code examples
Breadcrumbs help users navigate and understand their location in the website's hierarchy, improving overall user experience.
Breadcrumbs can be included anywhere on a page but will only appear once. Breadcrumbs are based on the application's structure. You can either pass the current structure from the session at any level or pass an empty array. Typestack will automatically retrieve the structure from the session.
You can make Hans and Gretel proud by including the following code in your website:
You can either let Typestack generate the breadcrumbs with structure, from any level you wish, or without structure.
In both cases we need to pass an array as an argument or else the class will not work.
Without a structure
With a structure
If we want control over our breadcrumbs, and choose where we want to output them, the simplest way is to create an include slide and point the slide URL to the /shared/breadcrumbs.php
file
For some more customization, follow the example below:
In most cases, we only want the breadcrumbs to be outputted once per page. And we also want a wrapper for the breadcrumbs to be positioned and styled in.
The result below shows the default implementation of the breadcrumbs
Using the template provided, styling your breadcrumbs is quick and easy. Most colours, font sizes, font types, etc. are defined in our central template. Any styling exceptions? No problem. Just edit the .css file and you should be good.
These values are fetched from the main theme using global CSS variables. Variables may be overruled if the styling of the breadcrumbs differ from the main template.
That's it! You now have breadcrumbs in your website.