% if @breadcrumbs_items&.length %>
<% archived_exists = @breadcrumbs_items.any? { |item| item[:archived] } %>
<% @breadcrumbs_items.each { |item| item[:label] = "(A) #{item[:label]}" if archived_exists } %>
<% shortened = @breadcrumbs_items.length > 4 %>
<% if shortened %>
<% first_breadcrumb_item = @breadcrumbs_items.shift
last_breadcrumb_items = @breadcrumbs_items.pop(2) %>
<%= link_to(first_breadcrumb_item[:label], first_breadcrumb_item[:url],
class: "breadcrumbs-link",
title: first_breadcrumb_item[:label]) %>
<%= image_tag "icon_small/navigate_next.svg",
alt: "navigate next",
class: "navigate_next" %>
•••
<%= image_tag "icon_small/navigate_next.svg",
alt: "navigate next",
class: "navigate_next" %>
<% item = last_breadcrumb_items.first %>
<%= link_to(item[:label], item[:url],
class: "breadcrumbs-link",
title: item[:label]) %>
<%= image_tag "icon_small/navigate_next.svg",
alt: "navigate next",
class: "navigate_next" %>
<% last_item = last_breadcrumb_items.last %>
<%= last_item[:label] %>
<% else %>
<% last_item = @breadcrumbs_items.pop %>
<% @breadcrumbs_items.each do |item| %>
<%= link_to(item[:label], item[:url],
class: "breadcrumbs-link",
title: item[:label]) %>
"
alt="navigate next"
class="navigate_next">
<% end %>
<%= last_item[:label] %>
<% end %>
<% end %>