Metadata-Version: 2.4
Name: stapel-cms
Version: 0.1.0
Summary: Public content: pages, blog, menus and SEO for the Stapel framework
License: MIT
Project-URL: Homepage, https://github.com/usestapel/stapel-cms
Project-URL: Repository, https://github.com/usestapel/stapel-cms
Project-URL: Documentation, https://github.com/usestapel/stapel-cms#readme
Project-URL: Changelog, https://github.com/usestapel/stapel-cms/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/usestapel/stapel-cms/issues
Keywords: django,stapel,cms,pages,blog,menus,seo
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: stapel-core<1.0,>=0.99.3
Requires-Dist: pydantic<3,>=2.6
Provides-Extra: all
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-django; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: stapel-tools<1,>=0.84.0; extra == "test"
Requires-Dist: jsonschema>=4; extra == "test"
Requires-Dist: stapel-translate<1,>0.8.5; extra == "test"
Requires-Dist: stapel-forms<1,>0.6.3; extra == "test"
Dynamic: license-file

<!-- Generated by stapel-readme from docs/readme.md + docs/*.json. Do not edit this file; edit docs/readme.md and re-run `make readme`. -->

# stapel-cms

[![CI](https://img.shields.io/github/actions/workflow/status/usestapel/stapel-cms/ci.yml?branch=main&logo=github&label=CI)](https://github.com/usestapel/stapel-cms/actions/workflows/ci.yml?query=branch%3Amain)
[![coverage](https://img.shields.io/codecov/c/github/usestapel/stapel-cms?branch=main&logo=codecov&label=coverage)](https://app.codecov.io/gh/usestapel/stapel-cms)
[![pypi](https://img.shields.io/pypi/v/stapel-cms?logo=pypi&logoColor=white&label=pypi)](https://pypi.org/project/stapel-cms/)
[![downloads](https://static.pepy.tech/badge/stapel-cms/month)](https://pepy.tech/project/stapel-cms)
[![python](https://img.shields.io/pypi/pyversions/stapel-cms?logo=python&logoColor=white)](https://pypi.org/project/stapel-cms/)
[![license](https://img.shields.io/github/license/usestapel/stapel-cms)](https://github.com/usestapel/stapel-cms/blob/main/LICENSE)
[![llms.txt](https://img.shields.io/badge/llms.txt-blue)](https://github.com/usestapel/stapel-cms/blob/main/docs/llms.txt)

> Public site content for a Stapel product: pages in a slug tree, a blog (posts, tags, date and tag archives, RSS/Atom), menus (header/footer trees targeting pages, posts, URLs or named frontend routes), SEO fields and a sitemap Function, and redirects written automatically when a published page or post moves. Bodies are typed block lists (rich_text as a ProseMirror/TipTap JSON document, hero, faq, gallery, embed with a host allowlist, a stapel-forms form by id, an opaque listing_rail query) validated by pydantic models from a MERGE registry, so a project adds its own block without forking. Staff write drafts, preview them by a signed link, publish now or on a schedule, keep editing while the published snapshot serves, restore revisions and archive; every publication is a fact. Content is site-scoped through the stapel-core site registry and locale-scoped with a fallback chain; a page can be copied into another locale, optionally through a machine-translation Function. The anonymous read is cached per site and answers conditional requests (ETag, Last-Modified). Not stapel-docs: docs is private workspace documents; cms is what an anonymous visitor reads at a URL of the site.

Part of the [Stapel framework](https://github.com/usestapel) — composable Django apps that deploy as a monolith or as microservices without changing module code.

## Install

```bash
pip install stapel-cms
```

## At a glance

| Fact | Value |
|---|---|
| Version | `0.1.0` |
| Python | `>=3.11` (3.11, 3.12, 3.13, 3.14) |
| HTTP operations | 41 |
| Config axes | 3 |
| Usage surface | 10 |
| Extension points | 9 |
| Error codes | 71 |
| Documented flows | 4 |
| Fleet dependencies | [`stapel-cdn`](https://github.com/usestapel/stapel-cdn) (optional) · [`stapel-core`](https://github.com/usestapel/stapel-core) · [`stapel-forms`](https://github.com/usestapel/stapel-forms) (optional) · [`stapel-translate`](https://github.com/usestapel/stapel-translate) (optional) |

## Documentation

**Errors:** [English](https://github.com/usestapel/stapel-cms/blob/main/docs/errors.en.md) · [Español](https://github.com/usestapel/stapel-cms/blob/main/docs/errors.es.md) · [Русский](https://github.com/usestapel/stapel-cms/blob/main/docs/errors.ru.md) · [OpenAPI](https://github.com/usestapel/stapel-cms/blob/main/docs/schema.json) · [capabilities.json](https://github.com/usestapel/stapel-cms/blob/main/docs/capabilities.json) · [llms.txt (for agents)](https://github.com/usestapel/stapel-cms/blob/main/docs/llms.txt)

## What this is

Public site content for a Stapel product: **pages** in a slug tree, a
**blog** (posts, tags, archives, RSS/Atom), **menus**, **SEO** fields, a
sitemap Function and **redirects** written for you when a published page
moves. Staff write typed blocks, preview drafts by a signed link, publish
now or on a schedule, and restore revisions; the anonymous read is cached per
site and answers conditional requests. Content is scoped by the stapel-core
site registry and by locale, with a fallback chain.

Not stapel-docs: docs holds private workspace documents; cms holds what an
anonymous visitor reads at a URL of the site.

## Quick start

```python
INSTALLED_APPS = [
    # ...
    "stapel_cms",
]

STAPEL_CMS = {
    "LOCALES": ["en", "de"],
    "DEFAULT_LOCALE": "en",
}

# urls.py
path("cms/", include("stapel_cms.urls"))   # -> /cms/api/v1/...

# settings.py — scheduled publication every minute (Celery optional;
# `manage.py cms_publish_due` runs the same pass)
from stapel_cms.beat import get_cms_beat_schedule
CELERY_BEAT_SCHEDULE = {**get_cms_beat_schedule()}
```

```bash
python manage.py migrate
python manage.py cms_seed          # about, contacts, terms, privacy, faq as drafts
```

A project's own block is one pydantic model and one setting:

```python
from pydantic import Field
from stapel_cms.blocks import BlockData

class PricingTable(BlockData):
    plans: list[str] = Field(min_length=1, max_length=5)

STAPEL_CMS = {"BLOCK_TYPES": {"pricing_table": "myapp.blocks.PricingTable"}}
```

## Concepts

- **Page / Post** — the row is the staff's working copy; the public reads
  the **published snapshot** (a revision), so edits are invisible until
  published again. Workflow `draft → scheduled → published → archived`;
  every save, publish and schedule appends a revision; restore copies one
  back into the working copy. Optimistic lock on `version`.
- **Blocks** — `[{type, id, data}]`, each type a pydantic model from a MERGE
  registry: `rich_text` (a ProseMirror/TipTap JSON document — never HTML),
  `hero`, `faq`, `gallery`, `embed` (allowlisted hosts), `form` (a
  stapel-forms id), `listing_rail` (an opaque query for another module).
  Every link passes one safe-URL rule; `javascript:` and friends cannot be
  stored.
- **Paths and redirects** — a page's path is its ancestors' slugs; moving a
  published page (or renaming a published post) writes `old → new`
  redirects for the whole subtree, chains collapse, a page beats a redirect.
- **Sites and locales** — every row has a site key (stapel-core site
  registry; `""` on a single host) and a locale; reads fall back
  `requested → LOCALE_FALLBACKS → DEFAULT_LOCALE`; variants share a
  translation group (hreflang alternates). Machine translation is an
  optional Function.
- **Caching** — public bodies are cached per site and invalidated as a whole
  on every publish; `ETag` / `Last-Modified` answer 304.
- **GDPR** — staff ids are the only personal data; erasure pseudonymizes
  them and keeps the content.

## License

MIT — see [LICENSE](https://github.com/usestapel/stapel-cms/blob/main/LICENSE).

---

<sub>This page is assembled by `stapel-readme` from `docs/readme.md` plus the contract artifacts in `docs/`. Edit the prose in `docs/readme.md`; the badges, facts and links above and below it are generated — do not hand-edit `README.md`.</sub>
