added navigation to the changelog and blog posts

This commit is contained in:
Ell 2024-08-11 20:01:06 +02:00
parent dcd8aa99be
commit 2f6cec1cdd
6 changed files with 23 additions and 6 deletions

View file

@ -5,3 +5,4 @@
{% if page.next %}
<a class="nav-item nav-link" href="{{ page.next.url }}">⏭️ Next Post</a>
{% endif %}
{% include tocnavitem.html headers="h1, h2, h3, h4, h5, h6" %}

View file

@ -0,0 +1,2 @@
<a class="nav-item nav-link" href="../../">🏠 Home</a>
{% include tocnavitem.html headers="h2" %}

View file

@ -39,10 +39,6 @@
});
</script>
</span>
<script>
$(".navbar-collapse a").on("click", () => $(".navbar-collapse").collapse("hide"));
</script>
</div>
</div>
</nav>

View file

@ -0,0 +1,17 @@
<div class="nav-item dropdown">
<a class="nav-link dropdown-toggle" type="button" data-toggle="dropdown">🧭 Navigation</a>
<div class="dropdown-menu">
<div id="navigator-content" style="height: auto; max-height: 50vh; overflow-y: scroll;"></div>
<script>
$(() => $("{{ include.headers }}").each((i, h) => {
console.log(h);
let offset = `${0.5 + Number(h.nodeName.substring(1)) - 1}rem`;
console.log(offset);
$("#navigator-content").append(`
<a class="nav-item nav-link dropdown-item-text" href="#${h.id}" style="padding-left: ${offset}; white-space: nowrap;">
${h.innerText.trim()}
</a>`);
}));
</script>
</div>
</div>

View file

@ -1,6 +1,6 @@
---
layout: default
nav: basicnav.html
nav: changelognav.html
title: Tiny Life Changelog
summary: The full changelog for Tiny Life
---

View file

@ -256,7 +256,8 @@ h1:hover .anchor-heading, h2:hover .anchor-heading, h3:hover .anchor-heading, h4
visibility: visible;
}
body.dark-mode {
body.dark-mode,
body.dark-mode .dropdown-menu {
color: #d8d8d8;
background-color: #1b1b1b;
}