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://themusicsecret.com/reference/instrument/
, it shows:
Home > Reference > Instrument
.
Quick start
1. Add to settings
Add "dynamic_breadcrumbs" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [
...
'dynamic_breadcrumbs',
]
2. Add context processor
Add "dynamic_breadcrumbs.context_processors.breadcrumbs"
the dynamic-breadcrumbs context processor to your settings like this::
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 breadcrumbs.html
template code.
{% block breadcrumbs %}
{% if breadcrumbs %}
<div class="container">
{% include "dynamic_breadcrumbs/breadcrumbs.html" with breadcrumbs=breadcrumbs%}
</div>
{% endif %}
{% endblock %}
Now each time you visit a page which makes use of the above template, it will have the breadcrumbs generated from the URL path.
References
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
Close
Hashes for django-dynamic-breadcrumbs-0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddd425dfe5a1aeb7716d649cae5825efa831723b517e6f69e706cb37ee236255 |
|
MD5 | 31bba0af4338efaf5783fe5cc7cc6491 |
|
BLAKE2b-256 | c0f8ae61c782c6b083bf1dc77cd0738d0484e8090ea6c0a36e61bd1072b79608 |