Reusable Django CMS package with SEO-optimized pages and hierarchical menus
Project description
Django Directory CMS
A reusable Django CMS package providing SEO-optimized pages and hierarchical menus with Bootstrap Icons support.
Features
-
Pages App: Highly SEO-optimized static pages with:
- 16 SEO fields (title, meta description, OG tags, Twitter cards, schema.org)
- Automatic slug generation with collision handling
- Integration with
django-seo-auditfor SEO scoring - Publishing controls (active, published status)
-
Menus App: Hierarchical navigation menus with:
- Parent/child relationships for dropdown menus
- Bootstrap Icons integration (42 curated icons)
- Page linking with automatic URL updates
- Custom URL support for external links
- Order control and visibility settings
- Global context processor for site-wide access
Installation
pip install django-directory-cms
Quick Start
1. Add to INSTALLED_APPS
# settings.py
INSTALLED_APPS = [
# ...
"django_directory_cms.pages",
"django_directory_cms.menus",
# Required dependency
"django_seo_audit",
]
2. Add Context Processor
# settings.py
TEMPLATES = [
{
"OPTIONS": {
"context_processors": [
# ...
"django_directory_cms.menus.context_processors.menu_items",
],
},
},
]
3. Run Migrations
python manage.py migrate django_directory_cms_pages
python manage.py migrate django_directory_cms_menus
4. Include URLs
# urls.py
from django.urls import include, path
urlpatterns = [
# ...
path("pages/", include("django_directory_cms.pages.urls")),
]
Usage
Creating Pages
Pages can be created via Django admin or programmatically:
from django_directory_cms.pages.models import Page
page = Page.objects.create(
title="About Us",
content="<p>Welcome to our site!</p>",
seo_title="About Our Company",
meta_description="Learn more about our mission and values",
is_published=True,
)
# Access SEO methods from django-seo-audit mixin
print(page.get_seo_title()) # "About Our Company"
print(page.get_absolute_url()) # "/pages/about-us/"
Creating Menus
Menu items can link to pages or custom URLs:
from django_directory_cms.menus.models import MenuItem
# Link to a page
menu_item = MenuItem.objects.create(
title="About",
anchor_text="About",
page=page,
icon_class="bi-info-circle",
order=1,
)
# Custom external link
external_link = MenuItem.objects.create(
title="Documentation",
anchor_text="Docs",
url="https://docs.example.com",
icon_class="bi-book",
is_external=True,
order=2,
)
# Hierarchical menu
parent = MenuItem.objects.create(
title="Resources",
anchor_text="Resources",
url="/resources/",
order=3,
)
child = MenuItem.objects.create(
title="Blog",
anchor_text="Blog",
url="/blog/",
parent=parent,
order=1,
)
Templates
Access menus in templates via context processor:
<!-- Menu items are available globally as `menu_items` -->
<nav>
<ul>
{% for item in menu_items %}
<li>
<a href="{{ item.get_url }}" {% if item.is_external %}target="_blank"{% endif %}>
{% if item.display_icon %}<i class="{{ item.display_icon }}"></i>{% endif %}
{{ item.anchor_text }}
</a>
{% if item.menu_children %}
<ul>
{% for child in item.menu_children %}
<li><a href="{{ child.get_url }}">{{ child.anchor_text }}</a></li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
</ul>
</nav>
Requirements
- Python 3.12+
- Django 4.2+
- django-seo-audit 0.2.0+
- Pillow 10.0.0+ (for image fields)
License
MIT License - see LICENSE file for details.
Credits
Built by the Directory Platform team.
Links
- GitHub: https://github.com/directory-platform/django-directory-cms
- PyPI: https://pypi.org/project/django-directory-cms/
- Issues: https://github.com/directory-platform/django-directory-cms/issues
Development
See CLAUDE.md for development guidelines and architecture documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_directory_cms-0.1.0.tar.gz.
File metadata
- Download URL: django_directory_cms-0.1.0.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8c106e9b1d1ec818010cc98f0729226be1c226f45ddadc57c12e4954d4336ab
|
|
| MD5 |
ad63f60441c3d230f2a8404ca2017a43
|
|
| BLAKE2b-256 |
f017857f22d9b06221a2386cca8616bf8950a2ff9ab395c1fe04b832212b2c0a
|
Provenance
The following attestation bundles were made for django_directory_cms-0.1.0.tar.gz:
Publisher:
publish.yml on heysamtexas/django-directory-cms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_directory_cms-0.1.0.tar.gz -
Subject digest:
c8c106e9b1d1ec818010cc98f0729226be1c226f45ddadc57c12e4954d4336ab - Sigstore transparency entry: 602075480
- Sigstore integration time:
-
Permalink:
heysamtexas/django-directory-cms@371cf389e954e508c9607e7d91c49d49c1cbfe19 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/heysamtexas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@371cf389e954e508c9607e7d91c49d49c1cbfe19 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_directory_cms-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_directory_cms-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
466215b21e8105d4d84bfc9fc8ab86d867e977666b9d9b768eaa8efe0d0274ad
|
|
| MD5 |
18c295cd49c39967e7838437b14073e2
|
|
| BLAKE2b-256 |
18f1c185dc29cd5b365dc874e4b89bc6b3eb701ae189d4e90f7ff7bfd424a270
|
Provenance
The following attestation bundles were made for django_directory_cms-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on heysamtexas/django-directory-cms
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_directory_cms-0.1.0-py3-none-any.whl -
Subject digest:
466215b21e8105d4d84bfc9fc8ab86d867e977666b9d9b768eaa8efe0d0274ad - Sigstore transparency entry: 602075484
- Sigstore integration time:
-
Permalink:
heysamtexas/django-directory-cms@371cf389e954e508c9607e7d91c49d49c1cbfe19 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/heysamtexas
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@371cf389e954e508c9607e7d91c49d49c1cbfe19 -
Trigger Event:
release
-
Statement type: