{% set cache = pimcore_cache(breadcrumbsCacheKey) %}
{% if not isFrontendRequestByAdmin and not cache.start() %}
	{# Build #}
	{% set homepage = pimcore_document(1) %}
	{% set breadcrumbs = null %}
	{% set navStartNode = document.getProperty('navigationRoot') %}
	{% if navStartNode is not instanceof('\\Pimcore\\Model\\Document\\Page') %}
		{% set navStartNode = homepage %}
	{% endif %}
	{% if navStartNode is instanceof('\\Pimcore\\Model\\Document\\Page') %}
		{% set breadcrumbs = pimcore_build_nav({
			active: document,
			root: navStartNode,
		}) %}
		{% set activePages = breadcrumbs.findAllBy('active', true) %}
		{% if activePages is empty %}
			{% set breadcrumbs = null %}
		{% endif %}
	{% endif %}
	{# Homepage #}
	{# Does not work, added manually in templates/snippet/breadcrumbsRender.html.twig #}
	{# Reference: https://pimcore.com/docs/6.x/Development_Documentation/Documents/Navigation.html#page_FAQ #}
	{# {% if breadcrumbs is not null and navStartNode.id == homepage.id %}
	{% do breadcrumbs.addPage({
		'order': -1,
		'uri': homepage.getPath(),
		'label': homepage.getProperty('navigation_name'),
		'title': homepage.getProperty('navigation_title'),
		'active': doc_is_active(homepage.id),
	}) %}
	{% endif %} #}
	{# Extend #}
	{% set breadcrumbs = extend_breadcrumbs(breadcrumbs, addToBreadcrumbs) %}
	{# Render #}
	{% if breadcrumbs is not null %}
		{% do pimcore_nav_renderer('breadcrumbs').setMinDepth(0) %}
		{{ pimcore_render_nav(breadcrumbs, 'breadcrumbs', 'renderPartial', 'snippet/breadcrumbsRender.html.twig') }}
	{% endif %}
	{% do cache.end() %}
{% endif %}
