guide.deuxfleurs.fr/templates/index.html

104 lines
3.3 KiB
HTML
Raw Normal View History

2022-05-10 15:52:28 +00:00
{% import "_macros.html" as macros %}
2022-06-01 14:41:21 +00:00
{% import "_nav.html" as nav %}
2022-05-10 15:52:28 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %}{{ config.title }}{% endblock title %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{% block favicon %}
2022-06-01 14:41:21 +00:00
<link rel="icon" type="image/png" href="/favicon.ico">
2022-05-10 15:52:28 +00:00
{% endblock favicon %}
{% include "_variables.html" %}
<link rel="stylesheet" href="/normalize.css">
<link rel="stylesheet" href="{{ get_url(path="juice.css") }}">
{% block head %}
{% endblock head %}
</head>
<body>
{% block header %}
2022-12-21 23:07:05 +00:00
<header class="box-shadow top-nav">
2022-05-10 15:52:28 +00:00
{{ macros::render_header() }}
</header>
{% endblock header %}
<main>
2022-12-21 23:07:05 +00:00
{% block mainnav %}
{% if page.ancestors or section.ancestors %}
<input id="menu-toggle" type="checkbox" {% if section.subsections or section.pages %}checked{% endif %} />
<label class='menu-button-container' for="menu-toggle">
<div class='menu-button'></div>
</label>
<div class="toc" id="navigation">
<div class="toc-sticky">
{% if page %}
{{ nav::navmenu(current=page) }}
{% else %}
{{ nav::navmenu(current=section) }}
{% endif %}
</div>
</div>
2022-06-01 14:41:21 +00:00
{% endif %}
2022-12-21 23:07:05 +00:00
{% endblock mainnav %}
2022-05-10 15:52:28 +00:00
<div class="content text">
{% block content %}
2022-06-01 14:41:21 +00:00
<div id="features" class="heading-text">{{ section.title }} </div>
2022-05-10 15:52:28 +00:00
{{ section.content | safe }}
{% endblock content %}
</div>
{% block sidebar %}
{% endblock sidebar %}
</main>
{% block footer %}
<footer>
<small class="subtext">
2022-06-01 14:41:21 +00:00
Édité et hébergé par <a href="https://deuxfleurs.fr">Deuxfleurs</a>,
généré par <a href="https://www.getzola.org">Zola</a>,
thème dérivé de <a href="https://github.com/huhu/juice">Juice</a>,
servi par <a href="https://garagehq.deuxfleurs.fr/">Garage</a>.
2022-05-10 15:52:28 +00:00
</small>
</footer>
{% endblock footer %}
</body>
<script>
function highlightNav(heading) {
let pathname = location.pathname;
document.querySelectorAll(".toc a").forEach((item) => {
item.classList.remove("active");
});
document.querySelector(".toc a[href$='" + pathname + "#" + heading + "']").classList.add("active");
}
let currentHeading = "";
window.onscroll = function () {
let h = document.querySelectorAll("h1,h2,h3,h4,h5,h6");
let elementArr = [];
h.forEach(item => {
if (item.id !== "") {
elementArr[item.id] = item.getBoundingClientRect().top;
}
});
elementArr.sort();
for (let key in elementArr) {
if (!elementArr.hasOwnProperty(key)) {
continue;
}
if (elementArr[key] > 0 && elementArr[key] < 300) {
if (currentHeading !== key) {
highlightNav(key);
currentHeading = key;
}
break;
}
}
}
</script>
</html>