% navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request) %>
<% prioritise_taxon_breadcrumbs ||= false %>
<% if navigation.content_tagged_to_current_step_by_step? %>
<%# Rendering step by step nav breadcrumbs because there's 1 step by step %>
<%= render 'govuk_publishing_components/components/step_by_step_nav_header',
navigation.step_nav_helper.header %>
<% elsif navigation.content_tagged_to_a_finder? %>
<%# Rendering finder breadcrumbs because the page is tagged to a finder %>
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
<% elsif navigation.content_is_tagged_to_a_live_taxon? && prioritise_taxon_breadcrumbs %>
<%# Rendering taxonomy breadcrumbs because the page is tagged to live taxons
and we want to prioritise them over all other breadcrumbs %>
<%= render 'govuk_publishing_components/components/breadcrumbs',
breadcrumbs: navigation.taxon_breadcrumbs[:breadcrumbs],
collapse_on_mobile: true %>
<% elsif navigation.content_tagged_to_mainstream_browse_pages? %>
<%# Rendering parent-based breadcrumbs because the page is tagged to mainstream browse %>
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
<% elsif navigation.content_has_curated_related_items? %>
<%# Rendering parent-based breadcrumbs because the page has curated related links %>
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
<% elsif navigation.content_is_tagged_to_a_live_taxon? && !navigation.content_is_a_specialist_document? %>
<%# Rendering taxonomy breadcrumbs because the page is tagged to live taxons %>
<%= render 'govuk_publishing_components/components/breadcrumbs',
breadcrumbs: navigation.taxon_breadcrumbs[:breadcrumbs],
collapse_on_mobile: true %>
<% elsif navigation.breadcrumbs.any? %>
<%# Rendering parent-based breadcrumbs because no browse, no related links, no live taxons %>
<%= render 'govuk_publishing_components/components/breadcrumbs', breadcrumbs: navigation.breadcrumbs %>
<% else %>
<%# Not rendering any breadcrumbs because there aren't any %>
<% end %>