{% comment %} ============================================================================= base.html: your own document skeleton, annotated line by line ============================================================================= COPY THIS FILE into your project as templates/base.html, then edit it freely. It is yours from that moment. brickwork does not ship it to you as a template you extend; this file is not on the template loader path and never will be (ADR-056). WHEN TO USE THIS instead of {% templatetag openblock %} extends "brickwork/shell/base.html" {% templatetag closeblock %}: you want to own the document outright, add your own meta tags, analytics, CSP nonces, or a second CSS bundle without fighting a block contract. brickwork's shipped shells stay importable and are the other first-class option (ADR-056 section 1): extend brickwork/shell/base.html and you receive future improvements automatically; copy this file and you receive them as a visible, opt-in diff you choose to apply. Both are supported. Neither is required. WHAT YOU STILL GET FROM THE PACKAGE after copying: the accessibility floor lives in brickwork.css (focus rings, contrast, reduced-motion) and in the components themselves (focus trap, ARIA wiring), NOT in this markup. So a brickwork upgrade still improves your pages even though you own this file. What you no longer receive automatically is structural change to the skeleton below, which is the point. EVERY LOAD-BEARING LINE IS ANNOTATED. If you remove a line marked LOAD-BEARING something will break, and the comment says what. States: none of its own; it is a raw document skeleton with no interactive markup beyond the skip link and the two empty overlay roots (both static, no open/closed state without a consumer's own components targeting them). Accessibility: ships the skip link as the first focusable element and the lang/dir/theme/density attributes on , exactly as brickwork/shell/base.html does (this file is the copy-paste twin of that shell). Covered by the archetype harness (a11y/archetypes.spec.mjs) and axe.spec.mjs: render succeeds, axe WCAG 2.2 AA passes, no horizontal overflow, light/dark are visibly distinct, and the skip link is the first tab stop with JavaScript disabled, at every W0.1 breakpoint (below-sm/sm/md/lg/xl/above-xl), both themes. Responsive: no width-dependent CSS of its own (a bare document with no layout). The viewport meta tag is load-bearing for every brickwork responsive layout a consumer builds on top of it, per the comment above. ============================================================================= {% endcomment %} {% load static i18n %} {% comment %} LOAD-BEARING: the four attributes on . brickwork's entire visual system is driven from :root, so these four axes MUST sit on the element. Putting them on
or on a wrapper div silently half-works: the derived color-mix tokens compute at :root and a lower hook cannot recolour them. data-theme "light" | "dark". Selects the token set. data-density "comfortable" | "compact". Scales spacing and control sizes. dir "ltr" | "rtl". brickwork uses CSS logical properties throughout, so this attribute alone flips the whole layout. You do not need RTL-specific CSS. data-bw-brand your brand slug, when you have registered brand tokens. OMIT THE ATTRIBUTE ENTIRELY when there is no brand: an empty data-bw-brand="" is not the same as absent, and would select a brand block that does not exist. The bw_* context variables come from brickwork.context_processors.theme. Add it to your TEMPLATES OPTIONS context_processors or these all fall back to the defaults below and your theming will never apply. (brickwork.W001 warns at startup if you forget; that check exists because this was the single most common support trap.) {% templatetag openblock %} firstof {% templatetag closeblock %}, never the |default filter: |default only substitutes for a defined-but-falsy value, so with a genuinely undefined variable it renders your string_if_invalid marker into the attribute. firstof ignores the resolution failure and is immune. {% endcomment %} {% comment %} LOAD-BEARING: the viewport meta. brickwork's responsive layouts, and the mobile drawer in particular, assume it. Without it a phone renders the desktop layout scaled down. {% endcomment %}