<header class="md-header" data-md-component="header">
  <nav class="md-header-nav md-grid">
    {% if config.extra.corner_logo %}
      <a href="{{ base_url }}"><div class="background-logo" style="background-image: url({{ base_url }}/{{ config.extra.corner_logo }});"></div>
    {% endif %}
    <div class="md-flex">
      <div class="md-flex__cell md-flex__cell--shrink">
        {% if config.extra.logo %}
          <a href="{{ base_url }}" title="{{ config.site_name }}" class="md-logo md-header-nav__button">
            <img src="{{ base_url }}/{{ config.extra.logo }}" width="36" height="36">
          </a>
        {% else %}
          <a href="{{ base_url }}" title="{{ config.site_name }}" class="md-icon md-icon--home md-header-nav__button">
          </a>
        {% endif %}
      </div>
      <div class="md-flex__cell md-flex__cell--shrink">
        <label class="md-icon md-icon--menu md-header-nav__button" for="drawer"></label>
      </div>
      <div class="md-flex__cell md-flex__cell--stretch">
        <span class="md-flex__ellipsis md-header-nav__title">
          {% block site_name %}
              {% if page %}

                  {% for parent in page.ancestors %}
                      <span class="md-header-nav__parent">
                      {{ parent.title }}
                      </span>
                  {% endfor %}
 
                  {% if page.title != "Home" %}
                      {{ page.title }}
                  {% else %}
                      {{ config.site_name }}
                  {% endif %}

              {% else %}

                  {{ config.site_name }}

              {% endif %}
          {% endblock %}
        </span>
      </div>
      <div class="md-flex__cell md-flex__cell--shrink">
        {% block search_box %}
          <label class="md-icon md-icon--search md-header-nav__button" for="search"></label>
          {% include "partials/search.html" %}
        {% endblock %}
      </div>
      <div class="md-flex__cell md-flex__cell--shrink">
        <div class="md-header-nav__source">
          {% if config.repo_url %}
            {% include "partials/source.html" %}
          {% endif %}
        </div>
      </div>
    </div>
  </nav>
</header>
