sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Provide _firstPublishedAt

Open jakst opened this issue 6 years ago • 6 comments
trafficstars

Currently there are two timestamps on a post I have created with sanity, _createdAt and _updatedAt. Both of these are helpful, but none of them contain information when the post was first published. _createdAt can be long before the post was published, if its been lying as a draft for a long time, and _updatedAt can be long after the post was first published if it has been updated many times.

I would like every post (or other item) to have a field called something like _firstPublishedAt, so that I can show my visitors when this post was actually first made available to them.

jakst avatar Aug 10 '19 13:08 jakst

Thanks for the input @Jakst! We can totally see the need for this and will discuss this internally.

kmelve avatar Aug 15 '19 06:08 kmelve

@Jakst You could also solve this by creating a webhook and patching the documents returned in the created array. Though I see how a such solution depends on your set up.

alejandrovrojas avatar Aug 23 '19 14:08 alejandrovrojas

Hmm okay, thanks @alevroub . I'll look into that meanwhile.

jakst avatar Aug 23 '19 16:08 jakst

From what I can tell the _createdAt-field behaves like a _firstPublishedAt-field (see https://github.com/sanity-io/sanity/issues/3232). Do you have the same experience?

jfulse avatar Apr 05 '22 07:04 jfulse

Any update on this? Maybe v3 can fix this if it requires breaking changes?

bline avatar Aug 07 '22 15:08 bline

@bline This is now easier to accomplish using Document actions. Have you looked into it?

alejandrovrojas avatar Aug 07 '22 17:08 alejandrovrojas

Thanks for reporting all! This issue ties into how the drafts model works, and is something we're planning to look into. We'll close this issue since this is already tracked internally.

kmelve avatar Jan 12 '23 18:01 kmelve