feat: scope the sidebar to the current category
Assisted-by: Delta:zai-glm-5.3
This commit is contained in:
4 files changed
+56
-1
No files matched your search
@@ -7,6 +7,7 @@ site generator.
|
||||
## Layout
|
||||
|
||||
- `site/` — website sources: `calepin.toml` + `.typ` pages
|
||||
- `site/themes/yggdrasil/` — local theme extending the bundled `calepin` theme
|
||||
- `public/` — generated site (gitignored)
|
||||
- `tools/` — pinned `calepin` and `typst` binaries (gitignored, downloaded on demand)
|
||||
- `scripts/` — helper scripts used by the Justfile and CI
|
||||
@@ -59,6 +60,12 @@ Sidebar labels come from the page's `#metadata(...)` line, not from the config.
|
||||
top navigation bar. The `label` is required here because the index page's
|
||||
metadata title is `Overview`.
|
||||
|
||||
Pages inside a category show only that category's sidebar section — the
|
||||
local theme (`site/themes/yggdrasil/partials/site-nav-sidebar.html`) filters
|
||||
the sidebar to the section containing the current page. Pages outside every
|
||||
category (landing page, `404`, standalone pages) fall back to the full
|
||||
sidebar.
|
||||
|
||||
## Deployment
|
||||
|
||||
`just build` produces a fully static site in `public/`: HTML pages plus
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
title = "Yggdrasil"
|
||||
description = "Personal knowledge base."
|
||||
base-url = "https://yggdrasil.kb28.ch"
|
||||
theme = "calepin"
|
||||
theme = "themes/yggdrasil"
|
||||
pdf = false
|
||||
minify = true
|
||||
search = "pagefind"
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<aside id="calepin-website-sidebar" class="calepin-website-sidebar">
|
||||
<nav class="calepin-website-mobile-drawer-nav" aria-label="Site navigation">
|
||||
<p><strong>Site</strong></p>
|
||||
<ul>
|
||||
{% for item in site.menus.main %}
|
||||
{% include "partials/site-nav-item.html" %}
|
||||
{% endfor %}
|
||||
{% for item in site.menus.social %}
|
||||
{% include "partials/site-nav-item.html" %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="calepin-website-mobile-drawer-actions" aria-label="Site controls">
|
||||
{% set calepin_theme_toggle_storage_key = "calepin-website-theme" %}
|
||||
{% set calepin_theme_toggle_param = "theme" %}
|
||||
{% include "partials/theme-toggle-button.html" %}
|
||||
{% include "partials/site-language-picker.html" %}
|
||||
{% if site.page_source or site.page_pdf %}
|
||||
<select class="calepin-website-view-mode" aria-label="Choose page view" data-calepin-view-mode>
|
||||
<option value="rendered">HTML</option>
|
||||
{% if site.page_source %}<option value="source">Source</option>{% endif %}
|
||||
{% if site.page_pdf %}<option value="pdf">PDF</option>{% endif %}
|
||||
</select>
|
||||
{% endif %}
|
||||
</div>
|
||||
</nav>
|
||||
<nav aria-label="Documentation">
|
||||
{#- Scope the sidebar to the current master category: render only
|
||||
the active section(s). Pages outside every section (landing,
|
||||
404, standalone pages) fall back to the full sidebar. -#}
|
||||
{% set active_sections = site.sidebar_sections | selectattr("active") | list %}
|
||||
{% if active_sections %}
|
||||
{% for section in active_sections %}
|
||||
{% include "partials/site-sidebar-section.html" %}
|
||||
{% endfor %}
|
||||
{% elif site.sidebar_sections %}
|
||||
{% for section in site.sidebar_sections %}
|
||||
{% include "partials/site-sidebar-section.html" %}
|
||||
{% endfor %}
|
||||
{% elif site.sidebar %}
|
||||
<ul>
|
||||
{% for item in site.sidebar %}
|
||||
{% include "partials/site-sidebar-item.html" %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</nav>
|
||||
</aside>
|
||||
@@ -0,0 +1 @@
|
||||
extends = "calepin"
|
||||
Reference in new issue
Block a user