{% if block.post_type == "pages" %}
    {% set current_post = post_type.pages[currentPage] %}
{% elseif block.post_type == "archive" %}
    {% set current_post = block.type[block.object] %}
{% elseif block.post_type == "taxonomy_archive" %}
    {% set current_post = taxonomies[block.taxonomy].terms[current_term] %}
{% else %}
    {% set current_post = post_type[block.post_type].items[currentPost] %}
{% endif %}

<nav aria-label="Breadcrumbs" class="breadcrumbs {{block.classes}}">
    <ul>
        {% if block.parents|length > 0 %}
            {% for parent_page_id in block.parents %}
                {% set parent_page = post_type.pages[parent_page_id] %}
                <li><a href="{{parent_page.url}}">{{parent_page.title}}</a></li>                
            {% endfor %}
        {% elseif current_post.terms and block.show_terms == true %}
            {% for current_post_term_id in current_post.terms %}
                {% set term = taxonomies[block.post_type].terms[current_post_term_id] %}
                <li><a href="{{term.url}}">{{term.name}}</a></li>                
            {% endfor %}
        {% elseif block.post_type == "archive" %}
            <li><a href="{{current_post.base.url}}">{{current_post.base.name}}</a></li>
        {% elseif block.post_type == "taxonomy_archive" %}
            <li><a href="{{current_post.base.url}}">{{current_post.base.name}}</a></li>
        {% elseif block.post_type == "courses" %}
            {% set degree = post_type.degrees.items[current_post.parent] %}
            <li><a href="{{degree.url}}">{{degree.title}}</a></li>
        {% elseif block.parents != false %}
            <li><a href="{{post_type[block.post_type].url}}">{{post_type[block.post_type].name}}</a></li>
        {% endif %}
        {% if current_post.name %}
            <li><h1 aria-current="page">{{current_post.name}}</h1></li>
        {% else %}
            <li><h1 aria-current="page">{{current_post.title}}</h1></li>
        {% endif %}  
    </ul>
</nav>