<header>

      <nav id="navbar" class="navbar navbar-light navbar-expand-sm {% if site.navbar_fixed %}fixed-top{% else %}sticky-top{% endif %}">
        <div class="container">
          {% if page.title != "about" -%}
          <a class="navbar-brand title font-weight-lighter" href="{{ site.baseurl | prepend: site.url }}/">
              {%- if site.title == "blank" -%}<span class="font-weight-bold">{{ site.first_name }}</span> {{ site.last_name }}{%- else -%}{{ site.title }}{%- endif -%}
          </a>
          {% endif %}
          <button class="navbar-toggler collapsed ml-auto" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar top-bar"></span>
            <span class="icon-bar middle-bar"></span>
            <span class="icon-bar bottom-bar"></span>
          </button>

          <div class="collapse navbar-collapse text-right" id="navbarNav">
            <ul class="navbar-nav ml-auto flex-nowrap">

              <li class="nav-item {% if page.title == 'about' %}active{% endif %}">
                <a class="nav-link" href="{{ '/' | relative_url }}">about
                  {%- if page.title == "about" -%}
                  <span class="sr-only">(current)</span>
                  {%- endif -%}
                </a>
              </li>

              {%- assign sorted_pages = site.pages | sort: "title" -%}
              {%- for p in sorted_pages -%}
              {%- if p.nav and p.autogen == nil -%}
              <li class="nav-item {% if page.title == p.title %}active{% endif %}">
                <a class="nav-link" href="{{ p.url | relative_url }}">{{ p.title }}
                  {%- if page.title == p.title -%}
                  <span class="sr-only">(current)</span>
                  {%- endif -%}
                </a>
              </li>
              {%- endif -%}
              {% endfor -%}

              {%- if site.enable_darkmode %}
              <div class = "toggle-container">
                <a id = "light-toggle">
                  <i class="fas fa-moon"></i>
                  <i class="fas fa-sun"></i>
                </a>
              </div>
              {%- endif %}
            </ul>
          </div>
        </div>
      </nav>
    </header>