Overview
GOV.UK Notify Admin uses Jinja2 templates with GOV.UK Frontend components via thegovuk-frontend-jinja package.
Template directory structure
Base templates
admin_template.html
The primary layout template extending GOV.UK Frontend:- Font preloading for performance
- CSP nonce support for inline scripts
- Rebrand flag for new GOV.UK styling
- Automatic error prefix in page titles
Loading JavaScript
The template loads both ESM and legacy JavaScript:all-esm.mjs; legacy browsers fall back to all.js.
Custom components
Component macros
Components are implemented as Jinja macros inapp/templates/components/:
live-search.html
data-notify-moduleattribute triggers JavaScript initializationdata-targetsprovides configuration to JavaScript- ARIA live region for screen reader announcements
page-header.html
Simple macro for consistent heading styles:Using components
GOV.UK Frontend integration
Using GOV.UK Frontend components
Import and use components fromgovuk_frontend_jinja:
Component overrides
Custom versions of GOV.UK Frontend components live ingovuk_frontend_jinja_overrides/:
- checkboxes/macro.html - Enhanced checkbox behavior
- nested-radios/macro.html - Radio groups with conditional content
- radios-with-images/macro.html - Radio options with image previews
JavaScript module initialization
Templates usedata-notify-module to trigger JavaScript:
Progressive enhancement
Templates hide JavaScript-enhanced features in non-supporting browsers:.govuk-frontend-supported class when JavaScript modules are available.
Template inheritance patterns
Extending base templates
Common block names
per_page_title- Page-specific title (appears before ” – GOV.UK Notify”)maincolumn_content- Main page content areaextra_javascripts- Additional JavaScript includesextra_stylesheets- Additional CSS includesmeta- Custom meta tags
Accessibility features
Error handling
Automatic error prefix in page titles:ARIA attributes
Components include proper ARIA labels:Related documentation
- JavaScript architecture - How templates connect to JavaScript
- SCSS and styling - Component styles
- GOV.UK Frontend documentation