{# The document shell. Every page extends this, directly or through the app's own base.html. What it owns: the
, the theme flash-guard, the asset links, and the header/main/footer skeleton. What it does not own: your brand, your nav, your footer text — those are blocks. Typical app base.html: {% extends "ui/shell.html" %} {% from "ui/nav.html" import brand, nav_links %} {% block site_title %}Acme{% endblock %} {% block brand %}{{ brand("Acme", url_for(request, "home"), "gauge") }}{% endblock %} {% block nav %}{{ nav_links(request, [("home", "Overview")]) }}{% endblock %} Fill the `sidebar` block instead of `nav` and the skeleton becomes a side column plus a thin top bar; see the note above . Pin the header to the top of the viewport while the page scrolls: {% block header_position %}sticky{% endblock %} #} {% from "ui/feedback.html" import toast, toaster %} {% from "ui/nav.html" import theme_toggle %} {% from "ui/sidebar.html" import sidebar_trigger %} {# Rendered into a variable rather than straight into the page, because three things downstream depend on whether the app filled it in: the aside has to come first in the body, the content wrapper beside it changes shape, and the header grows a toggle. Jinja cannot ask whether a block is empty, so the block is captured once here and the emptiness test runs on the string. The cost is buffering the sidebar's markup — a few hundred bytes — before the response starts. The alternative is a second flag the app has to remember to set, and that flag gets forgotten. #} {% set sidebar_slot %}{% block sidebar %}{% endblock %}{% endset %} {% set has_sidebar = sidebar_slot.strip() | length > 0 %} {# header_position: static | sticky A block rather than a variable for the reason every other seam here is one: a `{% set %}` written inside some other block in the app's base.html is scoped to that block and changes nothing, with no error, while a block override lands wherever it is written. Captured and compared like the sidebar slot, and only the exact word `sticky` switches — `fixed`, or a typo, keeps the header in the flow instead of emitting a position no rule was written for. `sticky` rather than `position: fixed`. A fixed bar leaves the flow, so `main` would need a top padding equal to the bar's height, and that height changes with the style pack, the brand mark and whatever `header_actions` holds. A sticky one keeps its own space and pins only once the page scrolls past it. #} {% set header_slot %}{% block header_position %}static{% endblock %}{% endset %} {% set sticky_header = header_slot.strip() == "sticky" -%} {# `scroll-pt-16` keeps an anchor target or a focused control from scrolling to a position underneath the pinned bar (WCAG 2.4.11). 4rem clears the bar's fixed `h-14` (3.5rem) with room to spare. #}