
This feature adds a horizontal bar under the top menu which tracks the vertical scroll position. Such a feature can be useful to represent how much is left to read on the current page more aesthetically. As this is an optional feature, `enable_progressbar` must be set to `true` in `_config.yml` to activate the functionality. I am not the original author of this code. I just made it compatible with the current version of the template at the time of this commit. The original code was most likely authored by Pankaj Parashar in this [post](https://css-tricks.com/reading-position-indicator/) made a few years before the first inclusion in an `al-folio` site. Then, the code was adapted for compatibility with the template at Anthony Plantanios' site. Finally, I did the last updates to have the code fit the new conventions used in the project. This was discussed in #557 Co-authored-by: rohandebsarkar <rohandebsarkar@gmail.com>
120 lines
4.9 KiB
HTML
120 lines
4.9 KiB
HTML
|
|
<header>
|
|
|
|
<!-- Nav Bar -->
|
|
<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.permalink != '/' -%}
|
|
<a class="navbar-brand title font-weight-lighter" href="{{ site.baseurl }}/">
|
|
{%- if site.title == "blank" -%}
|
|
{%- if site.first_name -%}
|
|
<span class="font-weight-bold">{{- site.first_name -}} </span>
|
|
{%- endif -%}
|
|
{%- if site.middle_name -%}
|
|
{{- site.middle_name -}}
|
|
{%- endif -%}
|
|
{%- if site.last_name -%}
|
|
{{- site.last_name -}}
|
|
{%- endif -%}
|
|
{%- else -%}
|
|
{{- site.title -}}
|
|
{%- endif -%}
|
|
</a>
|
|
{%- elsif site.enable_navbar_social -%}
|
|
<!-- Social Icons -->
|
|
<div class="navbar-brand social">
|
|
{% include social.html %}
|
|
</div>
|
|
{% endif %}
|
|
<!-- Navbar Toggle -->
|
|
<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">
|
|
|
|
{%- for page in site.pages -%}
|
|
{% if page.permalink == '/' %}
|
|
{% assign about_title = page.title %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
<!-- About -->
|
|
<li class="nav-item {% if page.permalink == '/' %}active{% endif %}">
|
|
<a class="nav-link" href="{{ '/' | relative_url }}">{{ about_title }}
|
|
{%- if page.permalink == '/' -%}
|
|
<span class="sr-only">(current)</span>
|
|
{%- endif -%}
|
|
</a>
|
|
</li>
|
|
{% if site.blog_nav_title %}
|
|
<!-- Blog -->
|
|
<li class="nav-item {% if page.url contains 'blog' %}active{% endif %}">
|
|
<a class="nav-link" href="{{ '/blog/' | relative_url }}">{{ site.blog_nav_title }}
|
|
{%- if page.url contains 'blog' -%}
|
|
<span class="sr-only">(current)</span>
|
|
{%- endif -%}
|
|
</a>
|
|
</li>
|
|
{%- endif %}
|
|
|
|
<!-- Other pages -->
|
|
{%- assign sorted_pages = site.pages | sort: "nav_order" -%}
|
|
{%- for p in sorted_pages -%}
|
|
{%- if p.nav and p.autogen == nil -%}
|
|
{%- if p.dropdown %}
|
|
<li class="nav-item dropdown {% if page.title == p.title %}active{% endif %}">
|
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{ p.title }}
|
|
{%- if page.title == p.title -%}
|
|
<span class="sr-only">(current)</span>
|
|
{%- endif -%}
|
|
</a>
|
|
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
|
|
{%- for child in p.children -%}
|
|
{%- if child.title == 'divider' %}
|
|
<div class="dropdown-divider"></div>
|
|
{%- else %}
|
|
<a class="dropdown-item" href="{{ child.permalink | relative_url }}">{{ child.title }}</a>
|
|
{%- endif -%}
|
|
{% endfor %}
|
|
</div>
|
|
</li>
|
|
{%- else %}
|
|
<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 -%}
|
|
{%- endif -%}
|
|
{% endfor -%}
|
|
{%- if site.enable_darkmode %}
|
|
|
|
<!-- Toogle theme mode -->
|
|
<li class="toggle-container">
|
|
<button id="light-toggle" title="Change theme">
|
|
<i class="fas fa-moon"></i>
|
|
<i class="fas fa-sun"></i>
|
|
</button>
|
|
</li>
|
|
{%- endif %}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
{% if site.enable_progressbar %}
|
|
<!-- Scrolling Progress Bar -->
|
|
<progress id="progress" value="0">
|
|
<div class="progress-container">
|
|
<span class="progress-bar"></span>
|
|
</div>
|
|
</progress>
|
|
{%- endif %}
|
|
</header>
|