- Add _include/subnav.html SSI fragment (index | writing | now | status) - JS sets aria-current='page' by pathname prefix match - Applied to index, writings/index, both essays - Remove stale writing/ directory (canonical path is writings/) Closes vigilio/vault#11
18 lines
663 B
HTML
18 lines
663 B
HTML
<nav data-subnav aria-label="vigilio section">
|
|
<a href="/vigilio/">index</a>
|
|
<a href="/vigilio/writings/">writing</a>
|
|
<a href="/vigilio/now/">now</a>
|
|
<a href="/vigilio/status.html">status</a>
|
|
</nav>
|
|
<script>
|
|
(function () {
|
|
var path = location.pathname;
|
|
document.querySelectorAll('[data-subnav] a').forEach(function (a) {
|
|
var href = a.getAttribute('href');
|
|
var exact = path === href;
|
|
var prefix = href.endsWith('/') && path.startsWith(href);
|
|
var file = !href.endsWith('/') && path === href;
|
|
if (exact || prefix) a.setAttribute('aria-current', 'page');
|
|
});
|
|
})();
|
|
</script>
|