Skip to content

Commit f4ec53a

Browse files
authored
Add experimental firstPublishedAt configuration (#2636)
* docs: add firstPublishedAt future flag * Move paragraph to config. heading and add cross-link
1 parent d2d2f2c commit f4ec53a

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

docusaurus/docs/cms/configurations/features.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To enable a future flag:
3131

3232
1. (_optional_) If the server is running, stop it with `Ctrl-C`.
3333
2. Open the `config/features.js|ts` file or create it if the file does not exist yet. The file will export a `future` object with all the future flags to enable.
34-
3. To enable a future flag, add its property name (see [full list](#available-future-flags)) to the `future` object and ensure the property's value is set to `true`. The following example shows how to enable the `contentReleasesScheduling` future flag:
34+
3. To enable a future flag, add its property name (see [full list](#available-future-flags)) to the `future` object and ensure the property's value is set to `true`. The following example shows how to enable the `experimental_firstPublishedAt` future flag:
3535

3636
<Tabs groupId='js-ts'>
3737

@@ -40,8 +40,7 @@ To enable a future flag:
4040
```ts title="/config/features.ts"
4141
module.export = ({ env }) => ({
4242
future: {
43-
// You could also simply write: contentReleases: true
44-
contentReleasesScheduling: env.bool('STRAPI_FUTURE_CONTENT_RELEASES_SCHEDULING', false),
43+
experimental_firstPublishedAt: env.bool('STRAPI_FUTURE_EXPERIMENTAL_FIRST_PUBLISHED_AT', false),
4544
},
4645
})
4746

@@ -50,10 +49,10 @@ To enable a future flag:
5049
This example assumes that you have an `.env` environment file at the root of your application and that the file includes the following line:
5150

5251
```json title=".env"
53-
STRAPI_FUTURE_CONTENT_RELEASES_SCHEDULING=true
52+
STRAPI_FUTURE_EXPERIMENTAL_FIRST_PUBLISHED_AT=true
5453
```
5554

56-
If your environment file does not include this value, the `contentReleasesScheduling` future flag property value will default to `false` and the experimental feature will not be enabled.
55+
If your environment file does not include this value, the `experimental_firstPublishedAt` future flag property value will default to `false` and the experimental feature will not be enabled.
5756

5857
</TabItem>
5958

@@ -62,19 +61,18 @@ To enable a future flag:
6261
```ts title="/config/features.ts"
6362
export default {
6463
future: {
65-
// You could also simply write: contentReleases: true
66-
contentReleasesScheduling: env.bool('STRAPI_FUTURE_CONTENT_RELEASES_SCHEDULING', false),
64+
experimental_firstPublishedAt: env.bool('STRAPI_FUTURE_EXPERIMENTAL_FIRST_PUBLISHED_AT', false),
6765
},
6866
};
6967
```
7068

7169
This example assumes that you have an `.env` environment file at the root of your application and that the file includes the following line:
7270

7371
```json title=".env"
74-
STRAPI_FUTURE_CONTENT_RELEASES_SCHEDULING=true
72+
STRAPI_FUTURE_EXPERIMENTAL_FIRST_PUBLISHED_AT=true
7573
```
7674

77-
If your environment file does not include this value, the `contentReleases` future flag property value will default to `false` and the experimental feature will not be enabled.
75+
If your environment file does not include this value, the `experimental_firstPublishedAt` future flag property value will default to `false` and the experimental feature will not be enabled.
7876

7977
</TabItem>
8078
</Tabs>
@@ -107,10 +105,6 @@ Developers can use the following APIs to interact with future flags:
107105

108106
## Available future flags
109107

110-
There are currently no available future flags. This section will be updated once new experimental features are available for testing.
111-
112-
<!-- The following future flags are currently available and can be used in the `future` object of the `config/features` configuration file:
113-
114-
| Property name | Related feature | Suggested environment variable name |
115-
| ----------------- | -------------------------------------------- | ----------------------------------------- |
116-
| `contentReleasesScheduling` | [Releases Scheduling](/cms/features/releases#usage) | `STRAPI_FUTURE_CONTENT_RELEASES_SCHEDULING` | -->
108+
| Property name | Related feature | Suggested environment variable name |
109+
| ------------- | --------------- | ---------------------------------- |
110+
| `experimental_firstPublishedAt` | [Draft & Publish](/cms/features/draft-and-publish#recording-the-first-publication-date) | `STRAPI_FUTURE_EXPERIMENTAL_FIRST_PUBLISHED_AT` |

docusaurus/docs/cms/features/draft-and-publish.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ For your content types to be managed with Draft & Publish in the Content Manager
4444
}}
4545
/>
4646

47+
### Recording the first publication date <FeatureFlagBadge feature="experimental_firstPublishedAt" /> {#recording-the-first-publication-date}
48+
49+
When this future flag is enabled (see [features configuration](/cms/configurations/features)), Strapi automatically adds a `firstPublishedAt` attribute to all content-types that use Draft & Publish. The attribute saves the date and time when an entry is first published and never changes even if the entry is unpublished and published again.
50+
51+
:::caution
52+
If the feature flag is disabled later, the `firstPublishedAt` attribute and its stored values are removed.
53+
:::
54+
4755
## Usage
4856

4957
With Draft & Publish enabled, the [Content Manager's edit view](/cms/features/content-manager#overview) indicates the current status of your content type's entry at the top of the interface. Your content can have 3 statuses:
@@ -101,10 +109,13 @@ When a document has both a draft and a published version available, the publishe
101109
}}
102110
/>
103111

112+
104113
:::tip
105114
To schedule publication (i.e. convert a draft to a published entry at a given date and time) you can include it in a release and schedule the publication of that release. Please refer to the [Releases feature](/cms/features/releases) documentation for more information.
106115
:::
107116

117+
118+
108119
### Unpublishing content
109120

110121
**Path:** <Icon name="feather" /> Content Manager, edit view of your content type

docusaurus/static/llms-full.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7065,13 +7065,9 @@ Developers can use the following APIs to interact with future flags:
70657065

70667066
## Available future flags
70677067

7068-
There are currently no available future flags. This section will be updated once new experimental features are available for testing.
7069-
7070-
<!-- The following future flags are currently available and can be used in the `future` object of the `config/features` configuration file:
7071-
7072-
| Property name | Related feature | Suggested environment variable name |
7073-
| ----------------- | -------------------------------------------- | ----------------------------------------- |
7074-
| `contentReleasesScheduling` | [Releases Scheduling](/cms/features/releases#usage) | `STRAPI_FUTURE_CONTENT_RELEASES_SCHEDULING` | -->
7068+
| Property name | Related feature | Suggested environment variable name |
7069+
| ------------- | --------------- | ---------------------------------- |
7070+
| `experimental_firstPublishedAt` | [Draft & Publish](/cms/features/draft-and-publish#recording-the-first-publication-date) | `STRAPI_FUTURE_EXPERIMENTAL_FIRST_PUBLISHED_AT` |
70757071

70767072

70777073

0 commit comments

Comments
 (0)