{% 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. ============================================================================= {% 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 %}