-
Notifications
You must be signed in to change notification settings - Fork 81
Draft publishing workflow documentation #605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b32affb
e5b146a
1a86d2c
c862d1a
6300b34
23b1d76
badd680
f1d8a33
9649491
6d17e9c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ The URL field supports a `{{$version}}` template variable. When included, the Vi | |
| https://your-site.com/preview?version={{$version}} | ||
| ``` | ||
|
|
||
| - **Resolution**: When no version is selected, `{{$version}}` resolves to `main`. | ||
| - **Resolution**: When no version is selected, `{{$version}}` resolves to `published`. | ||
| - **Flexibility**: The variable can be placed in any part of the URL (query parameters, path segments, subdomains, or hash fragments). | ||
|
|
||
| #### Implementation Checklist | ||
|
|
@@ -37,7 +37,7 @@ https://your-site.com/preview?version={{$version}} | |
| **1. Frontend Integration** | ||
| - **Template Variable**: You must include `{{$version}}` in the URL field. If omitted, the version selection dropdown will not appear in the Visual Editor toolbar. | ||
| - **Directus Frontend Library**: Your website must be configured using our publicly available [Frontend Library](1.frontend-library.md). | ||
| - **Version-Aware Fetching**: Your code must detect the version parameter from the URL and pass it to the Directus API (e.g., `/items/posts/42?version=draft`). Without this, the site will continue to display "Main" content regardless of your selection. | ||
| - **Version-Aware Fetching**: Your code must detect the version parameter from the URL and pass it to the Directus API (e.g., `/items/posts/42?version=draft`). Without this, the site will continue to display "Published" content regardless of your selection. | ||
|
|
||
| **2. Environment Configuration** | ||
|
|
||
|
|
@@ -86,18 +86,18 @@ When a URL includes the `{{$version}}` variable, a version dropdown appears in t | |
|
|
||
| The dropdown lists: | ||
|
|
||
| - **Main** — the published version (default) | ||
| - **Published** — the published version (default) | ||
| - **Draft** — the global [draft version](/guides/content/content-versioning#working-with-the-draft-version), always available for collections with versioning enabled | ||
|
|
||
| If your website URL contains a version key that doesn't match "main" or "draft" (e.g. from a custom query parameter), it will also appear as a dynamic option in the dropdown. | ||
| If your website URL contains a version key that doesn't match "published", "main", or "draft" (e.g. from a custom query parameter), it will also appear as a dynamic option in the dropdown. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the inclusion of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also @formfcw want to double check this is true beyond global versions (i.e. additional named local versions would appear in the visual studio dropdown)?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Since this text is about the visual editor, it is true, that local versions will appear in the dropdown. |
||
|
|
||
| ### Version-Aware Editing | ||
|
|
||
| When a version other than main is selected: | ||
| When a version other than "Published" is selected: | ||
|
|
||
| - **Only items on collections with versioning enabled** will show editable elements. Items on non-versioned collections are hidden from editing. | ||
| - **Saving an edit** creates or updates the version for that specific item. If the version doesn't exist yet for the item, it's created automatically on save. | ||
| - **Items without content in the selected version** display their main version content as a read-only fallback. | ||
| - **Items without content in the selected version** display their published version content as a read-only fallback. | ||
|
|
||
| ::callout{icon="material-symbols:info-outline"} | ||
| The version dropdown requires the user to have **read** permission on `directus_versions`. Editing in a version additionally requires **create** or **update** permission on `directus_versions`. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like an image here showing the selector would be ideal