HTMX_NAV_DEFAULT_PARTIAL
Type: str | PartialResolver | None (or any PartialSpec)
Default: "#content"
Applies to: render_nav, make_shell_renderer, make_shell_view_mixin
Specifies the fallback partial block, template path, or resolver when a view does not explicitly pass partial=....
Path Replacement (Multi-File)
When pages and partials are separate files (e.g. pages/x.html and partials/_x.html), configure PathReplace:
# settings.py
from htmx_nav import PathReplace
HTMX_NAV_DEFAULT_PARTIAL = PathReplace("pages/", "partials/_")
See Separate page and partial files (PathReplace) in the Targeting Guide for details.
To completely bypass partial extraction for full-page renders while keeping out-of-band swaps, pass partial=None directly to render_nav.
HTMX_NAV_TITLE_CONTEXT_KEY
The template context variable name used for page titles. Set this to match the variable name used in your base.html title tag:
<!-- base.html -->
<title>{% block title %}{{ page_title|default:"Home Page" }}{% endblock %}</title>
# settings.py
HTMX_NAV_TITLE_CONTEXT_KEY = "page_title"
This keeps page titles in sync across both request modes:
Full-page reloads: Passing title="Dashboard" to render_nav populates context["page_title"], which base.html renders.
HTMX requests: render_nav reads context["page_title"] and appends an escaped <title> tag to the response, which HTMX automatically applies to the browser tab.
HTMX_NAV_DEBUG_SWAPS
When True, appends a small inline <script> to swapped fragments that adds the hn-swap CSS class to the target DOM element, triggering a highlight animation.
django-htmx-nav checks HTMX_NAV_DEBUG_SWAPS directly without inspecting Django’s DEBUG setting. This independence allows you to enable debug swaps in staging or demo environments even when DEBUG = False.
See the Debugging Guide for CSS integration and custom styling.
Recommended Local Development Recipe
For standard local development, it is recommended to tie this setting directly to your Django DEBUG value:
# settings.py
HTMX_NAV_DEBUG_SWAPS = DEBUG