HTML coding guidelines

We use Django templates to author HTML.

Linting HTML

We use jinjalint to lint templates. If you have installed Wagtail’s testing dependencies (pip install -e .[testing]), you can check your code by running make lint.

Principles

  • Write valid HTML. We target the HTML5 doctype.
  • Write semantic HTML.
  • Attach JavaScript behavior with data- attributes, rather than classes or IDs.
  • For comments, use Django templates syntax instead of HTML.