A Django app to generate HTML breadcrumbs dynamically from URL path
Project description
django-dynamic-breadcrumbs
django-dynamic-breadcrumbs
is a Django app to generate HTML breadcrumbs
dynamically from URL paths.
At https://example.com/reference/instrument/guitar/
, shows:
Home > Reference > Instrument > Guitar
.
Quick start
1. Install
pip install django-dynamic-breadcrumbs
2. Add to settings
Add "dynamic_breadcrumbs" label to your INSTALLED_APPS settings:
INSTALLED_APPS = [
...
'dynamic_breadcrumbs',
]
Add dynamic_breadcrumbs.context_processors.breadcrumbs
to context_processors:
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [os.path.join(BASE_DIR, "templates")],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
#...
"dynamic_breadcrumbs.context_processors.breadcrumbs",
],
},
},
]
3. Add template
Include the dynamic_breadcrumbs/breadcrumbs.html
in your base template.
{% if breadcrumbs %}
<div class="container">
{% include "dynamic_breadcrumbs/breadcrumbs.html" with breadcrumbs=breadcrumbs%}
</div>
{% endif %}
Now each time you visit a page which makes use of the above template, it will have the breadcrumbs generated from the URL path.
4. (Optional) Customization
Tweak default settings.
Documentation
Full docs at: https://django-dynamic-breadcrumbs.readthedocs.io/
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-dynamic-breadcrumbs-0.4.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a79c6d082b5d3947eeca5dc580fa31e4a5c23ff0e6c49d034292b59eedbf18f9 |
|
MD5 | c5484cac660cc7e19cfdaec9c7e73a18 |
|
BLAKE2b-256 | a5df51882b3a572d02e9c2346db09a83be7460dbde39d80625735ae12036d9fb |