Metadata-Version: 2.4
Name: django-blog-plus
Version: 1.0.0
Summary: Enhanced features for django-blog-lotus: CTAs, cover styling, webhooks, and more
Author-email: Visian Systems <contact@visiansystems.com>
License-Expression: MIT
Project-URL: Homepage, https://gitlab.com/visian/django-blog
Project-URL: Documentation, https://gitlab.com/visian/django-blog#readme
Project-URL: Repository, https://gitlab.com/visian/django-blog
Project-URL: Issues, https://gitlab.com/visian/django-blog/-/issues
Keywords: django,blog,lotus,cms,cta,webhook
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.0
Classifier: Framework :: Django :: 4.1
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.2
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=4.0
Requires-Dist: django-blog-lotus>=0.9.5
Requires-Dist: requests>=2.28.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-django>=4.5; extra == "dev"
Requires-Dist: coverage>=7.0; extra == "dev"
Provides-Extra: ckeditor
Requires-Dist: django-ckeditor>=6.0.0; extra == "ckeditor"
Dynamic: license-file

# Django Blog Plus

Enhanced features for [django-blog-lotus](https://github.com/emencia/django-blog-lotus), providing additional functionality for professional blogging.

## Features

- **Call to Action (CTA) Blocks**: Create reusable CTA components and assign them to articles
- **Article Cover Styling**: Customize cover image backgrounds with preset or custom colors
- **View Tracking**: Track article views for popular/trending widgets
- **Webhook API**: Create and update articles programmatically via REST API
- **Scheduled Publishing**: Automatically publish draft articles at scheduled times
- **RSS/Atom Feeds**: Full syndication support with category feeds
- **SEO Enhancements**: Sitemaps, reading time, heading optimization
- **Premium Templates**: Modern, responsive blog templates

## Installation

```bash
pip install django-blog-plus
```

## Quick Start

1. Add to your `INSTALLED_APPS`:

```python
INSTALLED_APPS = [
    # ...
    'lotus',  # django-blog-lotus
    'django_blog_plus',
    # ...
]
```

2. Configure settings (optional):

```python
DJANGO_BLOG_PLUS = {
    'SITE_NAME': 'My Blog',
    'SITE_DESCRIPTION': 'A blog about interesting things',
    'WEBHOOK_SECRET': 'your-secret-key',
    'ARTICLE_PUBLISHED_WEBHOOK_URL': '',  # Optional Zapier/n8n webhook
    'BASE_TEMPLATE': 'base.html',  # Your project's base template
    'DEFAULT_COVER_BG_COLOR': '#f8f9fa',
}
```

3. Add URL patterns:

```python
from django.urls import path, include

urlpatterns = [
    # ...
    path('blog/', include('lotus.urls')),
    path('api/blog/', include('django_blog_plus.urls')),
    # ...
]
```

4. Run migrations:

```bash
python manage.py migrate django_blog_plus
```

5. Add context processor (for blog categories in templates):

```python
TEMPLATES = [
    {
        # ...
        'OPTIONS': {
            'context_processors': [
                # ...
                'django_blog_plus.context_processors.blog_categories',
                'django_blog_plus.context_processors.django_blog_plus_config',
            ],
        },
    },
]
```

## Configuration Reference

| Setting | Default | Description |
|---------|---------|-------------|
| `SITE_NAME` | `'Blog'` | Site name for RSS feeds |
| `SITE_DESCRIPTION` | `''` | Site description for RSS feeds |
| `WEBHOOK_SECRET` | `None` | Bearer token for webhook API authentication |
| `ARTICLE_PUBLISHED_WEBHOOK_URL` | `''` | URL to call when articles are published |
| `BASE_TEMPLATE` | `'base.html'` | Base template that blog templates extend |
| `DEFAULT_COVER_BG_COLOR` | `'#f8f9fa'` | Default background color for article covers |
| `COVER_BG_COLORS` | (preset list) | Available background color choices |

## Webhook API

### Create Article

```bash
curl -X POST https://yoursite.com/api/blog/webhook/ \
  -H "Authorization: Bearer YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "My Article",
    "content": "<h2>Hello</h2><p>World</p>",
    "category_slug": "news",
    "status": "published"
  }'
```

### Update Article

```bash
curl -X PATCH https://yoursite.com/api/blog/webhook/update/ \
  -H "Authorization: Bearer YOUR_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "article_url": "/blog/2024/01/15/my-article/",
    "title": "Updated Title"
  }'
```

See `/api/blog/webhook/info/` for full API documentation.

## Template Tags

```django
{% load django_blog_plus %}

{# Reading time #}
{% reading_time article.content %} min read

{# Previous/Next navigation #}
{% get_adjacent_articles article as nav %}
{% if nav.previous %}Previous: {{ nav.previous.title }}{% endif %}

{# Article CTA #}
{% get_article_cta article.id as cta %}
{% if cta %}{{ cta.title }}{% endif %}

{# Popular articles #}
{% get_popular_articles 5 as popular %}

{# Cover background color #}
{{ article|article_cover_bg }}
```

## Management Commands

```bash
# Publish scheduled articles (run via cron)
python manage.py publish_scheduled_articles

# Clean up placeholder images
python manage.py remove_blog_placeholder_images --dry-run
```

## License

MIT License - see LICENSE file for details.

## Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.
