From d75cea4edf75ff438ac42d98a69c7ba74200d7cc Mon Sep 17 00:00:00 2001 From: Thibaud Colas Date: Wed, 10 Jul 2024 10:26:59 +0100 Subject: [PATCH 1/4] First commit --- text/100-headless-support.md | 81 ++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 text/100-headless-support.md diff --git a/text/100-headless-support.md b/text/100-headless-support.md new file mode 100644 index 00000000..972e3dfd --- /dev/null +++ b/text/100-headless-support.md @@ -0,0 +1,81 @@ +# RFC 100: Headless support in Wagtail core + +- RFC: 100 +- Author: Thibaud Colas +- Created: 2024-07-31 +- Last Modified: 2024-07-31 + +## Abstract + +Wagtail’s support for headless websites should move closer to feature-parity with Django monoliths, without reliance on third-party packages for compatibility with core functionality. +For features that aren’t supported because of technical constraints, design decisions, or inertia, there should be documented workarounds or alternatives. + +## Why + +- Because a lot of existing and future sites would benefit from more cohesive headless support. +- Because it’s harder to maintain this kind of support across external packages. + +## Features to support + +Here are two rules to determine which current and future Wagtail features must be supported for headless websites: + +1. If a feature is "on by default" in Wagtail core, we must aim to support it with no external package or other custom Django implementation. +2. If a feature is on by default and unsupported, it must be possible to turn it off and we must document a workaround or alternative. + +## Feature-by-feature review + +Based on feature definitions from [Are we headless yet?](https://areweheadlessyet.wagtail.org/). + +| Feature | Goal in Wagtail core | Current status | +| ----------------------------------------------------------------------------------------- | -------------------- | ------------------ | +| [REST API](https://areweheadlessyet.wagtail.org/rest-api) | Full support | Full support | +| [GraphQL](https://areweheadlessyet.wagtail.org/graphql) | No support | External package | +| [Page Preview](https://areweheadlessyet.wagtail.org/page-preview) | Full support | External package | +| [Images](https://areweheadlessyet.wagtail.org/images) | Full support | Partial support | +| [Page URL Routing](https://areweheadlessyet.wagtail.org/page-url-routing) | Full support | Full support | +| [Rich Text](https://areweheadlessyet.wagtail.org/rich-text) | Full support | Known shortcomings | +| [Multi-site support](https://areweheadlessyet.wagtail.org/multi-site-support) | Full support | Known shortcomings | +| [Form submissions](https://areweheadlessyet.wagtail.org/form-submissions) | No support | No support | +| [Password-protected Pages](https://areweheadlessyet.wagtail.org/password-protected-pages) | Full support | No support | +| [Internationalisation](https://areweheadlessyet.wagtail.org/internationalisation) | Full support | TBC | +| [StreamField](https://areweheadlessyet.wagtail.org/streamfield) | Full support | TBC | +| Userbar | Full support | No support | +| Content checks | Full support | No support | + +## Gaps to address + +### Page Preview + +Support depends on the [wagtail-headless-preview](https://github.com/torchbox/wagtail-headless-preview) package. +This should instead be part of Wagtail core, either as-is implementation or equivalent. + +### Images + +- Add first-class support for responsive images and multi-format image generation in API responses. + +### Rich Text + +- Add a built-in way to render rich text fields in the API. + +### Password-protected Pages + +Missing support in the API. + +### Userbar + +Only available as a Django Templates template tag or Jinja2 function. Requires: + +- Authentication and authorization +- Loading of Wagtail static assets (CSS & JS) +- Loading of Wagtail UI components (HTML / Django Templates) + +### Content checks + +Only available via the userbar. In addition to the userbar, also requires: + +- Page Preview +- Cross-domain cross-frame communication + +## Open Questions + +TODO From 322337981818f507f0705853ad41c732c4d514ac Mon Sep 17 00:00:00 2001 From: Thibaud Colas Date: Wed, 31 Jul 2024 22:52:35 +0100 Subject: [PATCH 2/4] Update 100-headless-support.md --- text/100-headless-support.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/text/100-headless-support.md b/text/100-headless-support.md index 972e3dfd..101aa764 100644 --- a/text/100-headless-support.md +++ b/text/100-headless-support.md @@ -24,7 +24,7 @@ Here are two rules to determine which current and future Wagtail features must b ## Feature-by-feature review -Based on feature definitions from [Are we headless yet?](https://areweheadlessyet.wagtail.org/). +Started from feature definitions of [Are we headless yet?](https://areweheadlessyet.wagtail.org/), expanded as appropriate | Feature | Goal in Wagtail core | Current status | | ----------------------------------------------------------------------------------------- | -------------------- | ------------------ | @@ -41,6 +41,7 @@ Based on feature definitions from [Are we headless yet?](https://areweheadlessye | [StreamField](https://areweheadlessyet.wagtail.org/streamfield) | Full support | TBC | | Userbar | Full support | No support | | Content checks | Full support | No support | +| Redirects | Full support | No support | ## Gaps to address @@ -56,6 +57,7 @@ This should instead be part of Wagtail core, either as-is implementation or equi ### Rich Text - Add a built-in way to render rich text fields in the API. +- More reliable [link handling](https://github.com/wagtail/wagtail/pull/9984) ### Password-protected Pages From 6dcbcbb160626f53fb48462badf837228ff6a396 Mon Sep 17 00:00:00 2001 From: Thibaud Colas Date: Thu, 7 Nov 2024 17:24:42 +0000 Subject: [PATCH 3/4] Update 100-headless-support.md --- text/100-headless-support.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/text/100-headless-support.md b/text/100-headless-support.md index 101aa764..4c39302f 100644 --- a/text/100-headless-support.md +++ b/text/100-headless-support.md @@ -33,8 +33,8 @@ Started from feature definitions of [Are we headless yet?](https://areweheadless | [Page Preview](https://areweheadlessyet.wagtail.org/page-preview) | Full support | External package | | [Images](https://areweheadlessyet.wagtail.org/images) | Full support | Partial support | | [Page URL Routing](https://areweheadlessyet.wagtail.org/page-url-routing) | Full support | Full support | -| [Rich Text](https://areweheadlessyet.wagtail.org/rich-text) | Full support | Known shortcomings | -| [Multi-site support](https://areweheadlessyet.wagtail.org/multi-site-support) | Full support | Known shortcomings | +| [Rich Text](https://areweheadlessyet.wagtail.org/rich-text) | Full support | Partial support | +| [Multi-site support](https://areweheadlessyet.wagtail.org/multi-site-support) | Full support | Partial support | | [Form submissions](https://areweheadlessyet.wagtail.org/form-submissions) | No support | No support | | [Password-protected Pages](https://areweheadlessyet.wagtail.org/password-protected-pages) | Full support | No support | | [Internationalisation](https://areweheadlessyet.wagtail.org/internationalisation) | Full support | TBC | @@ -59,6 +59,11 @@ This should instead be part of Wagtail core, either as-is implementation or equi - Add a built-in way to render rich text fields in the API. - More reliable [link handling](https://github.com/wagtail/wagtail/pull/9984) +### Multi-site support + +- Overriding of [`get_url_parts`](https://docs.wagtail.org/en/stable/reference/pages/model_reference.html#wagtail.models.Page.get_url_parts) is crucial and under-documented. +- Support heavily dependent on [wagtail-headless-preview](https://github.com/torchbox/wagtail-headless-preview). + ### Password-protected Pages Missing support in the API. From 3757ef41b33b77029b30e86bd6f6da6c1899141c Mon Sep 17 00:00:00 2001 From: Thibaud Colas Date: Fri, 8 Nov 2024 10:21:33 +0000 Subject: [PATCH 4/4] Update 100-headless-support.md --- text/100-headless-support.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/text/100-headless-support.md b/text/100-headless-support.md index 4c39302f..c4dd4b64 100644 --- a/text/100-headless-support.md +++ b/text/100-headless-support.md @@ -76,6 +76,12 @@ Only available as a Django Templates template tag or Jinja2 function. Requires: - Loading of Wagtail static assets (CSS & JS) - Loading of Wagtail UI components (HTML / Django Templates) +Likely implementation: + +- Web Component (``) +- Data fetching from Wagtail backend via dedicated API endpoint. +- UI fetching from script tag or from Wagtail backend (via API endpoint?) + ### Content checks Only available via the userbar. In addition to the userbar, also requires: