pages/_layouts/distill.html
Carlos Morales 08a839c5f5
Add a progress bar to show the scroll position (#934)
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>
2022-10-24 15:08:26 +05:30

111 lines
3.0 KiB
HTML

<!DOCTYPE html>
<!-- _layouts/distill.html -->
<html>
<head>
{%- include head.html %}
{% include scripts/jquery.html %}
{% include scripts/mathjax.html %}
<!-- Distill js -->
<script src="{{ '/assets/js/distillpub/template.v2.js' | relative_url }}"></script>
<script src="{{ '/assets/js/distillpub/transforms.v2.js' | relative_url }}"></script>
<script src="{{ '/assets/js/distillpub/overrides.js' | relative_url }}"></script>
{% if page._styles %}
<!-- Page/Post style -->
<style type="text/css">
{{ page._styles }}
</style>
{%- endif %}
</head>
<d-front-matter>
<script async type="text/json">{
"title": "{{ page.title }}",
"description": "{{ page.description }}",
"published": "{{ page.date | date: '%B %-d, %Y' }}",
"authors": [
{% for author in page.authors -%}
{
"author": "{{ author.name }}",
"authorURL": "{{ author.url }}",
"affiliations": [
{
"name": "{{ author.affiliations.name }}",
"url": "{{ author.affiliations.url }}"
}
]
}{% if forloop.last == false %},{% endif %}
{% endfor %}
],
"katex": {
"delimiters": [
{
"left": "$",
"right": "$",
"display": false
},
{
"left": "$$",
"right": "$$",
"display": true
}
]
}
}</script>
</d-front-matter>
<body class="{%- if site.navbar_fixed -%}fixed-top-nav{%- endif -%} {%- unless site.footer_fixed -%}sticky-bottom-footer{%- endunless -%}">
<!-- Header -->
{%- include header.html %}
<!-- Content -->
<div class="post distill">
<d-title>
<h1>{{ page.title }}</h1>
<p>{{ page.description }}</p>
</d-title>
<d-byline></d-byline>
<d-article>
{% if page.toc -%}
<d-contents>
<nav class="l-text figcaption">
<h3>Contents</h3>
{% for section in page.toc -%}
<div><a href="#{{ section.name | slugify }}">{{ section.name }}</a></div>
{% if section.subsections -%}
<ul>
{% for subsection in section.subsections -%}
<li><a href="#{{ subsection.name | slugify }}">{{ subsection.name }}</a></li>
{% endfor %}
</ul>
{%- endif -%}
{%- endfor %}
</nav>
</d-contents>
{%- endif %}
{{ content }}
</d-article>
<d-appendix>
<d-footnote-list></d-footnote-list>
<d-citation-list></d-citation-list>
</d-appendix>
</div>
<!-- Footer -->
{%- include footer.html %}
<d-bibliography src="{{ page.bibliography | prepend: '/assets/bibliography/' | relative_url }}"></d-bibliography>
{% include scripts/bootstrap.html %}
{% include scripts/analytics.html %}
{% include scripts/progressBar.html %}
</body>
</html>