Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marcanuy/django-dynamic-breadcrumbs
Django app to generate HTML breadcrumbs from URL paths
https://github.com/marcanuy/django-dynamic-breadcrumbs
breadcrumb breadcrumb-navigation breadcrumbs breadcrumbs-dynamic django
Last synced: about 1 month ago
JSON representation
Django app to generate HTML breadcrumbs from URL paths
- Host: GitHub
- URL: https://github.com/marcanuy/django-dynamic-breadcrumbs
- Owner: marcanuy
- License: mit
- Created: 2021-06-30T20:20:34.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-20T20:26:22.000Z (about 1 year ago)
- Last Synced: 2024-04-25T04:02:19.447Z (7 months ago)
- Topics: breadcrumb, breadcrumb-navigation, breadcrumbs, breadcrumbs-dynamic, django
- Language: Python
- Homepage: https://django-dynamic-breadcrumbs.readthedocs.io/
- Size: 58.6 KB
- Stars: 10
- Watchers: 5
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
django-dynamic-breadcrumbs
=====[![Django CI](https://github.com/marcanuy/django-dynamic-breadcrumbs/actions/workflows/django.yml/badge.svg)](https://github.com/marcanuy/django-dynamic-breadcrumbs/actions/workflows/django.yml)
[![Coverage Status](https://coveralls.io/repos/github/marcanuy/django-dynamic-breadcrumbs/badge.svg?branch=main)](https://coveralls.io/github/marcanuy/django-dynamic-breadcrumbs?branch=main)
[![PyPI version](https://img.shields.io/pypi/v/django-dynamic-breadcrumbs)](https://pypi.org/project/django-dynamic-breadcrumbs/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Downloads](https://static.pepy.tech/badge/django-dynamic-breadcrumbs)](https://pepy.tech/project/django-dynamic-breadcrumbs)
[![Documentation Status](https://readthedocs.org/projects/django-dynamic-breadcrumbs/badge/?version=latest)](https://django-dynamic-breadcrumbs.readthedocs.io/en/latest/?badge=latest)`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**:
~~~ python
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 %}
{% include "dynamic_breadcrumbs/breadcrumbs.html" with breadcrumbs=breadcrumbs%}
{% 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](https://django-dynamic-breadcrumbs.readthedocs.io/en/latest/ref/settings.html).
# Example site
There is an example site to see how it works at [example_site](https://github.com/marcanuy/django-dynamic-breadcrumbs/tree/main/example_site). To
run it, in `example_site` directory:1. Create db: `python manage.py migrate`
2. Load fixtures `python manage.py loaddata fixtures.json`
3. Run the server `python manage.py runserver`Note: Fixtures were created with a sample database with `./manage.py dumpdata --all --format json -o fixtures.json`.
# Documentation
Full docs at: https://django-dynamic-breadcrumbs.readthedocs.io/
# License
MIT