How to maintain a record of last modified - IE a real _updatedAt
field?
#4692
Unanswered
pm0u
asked this question in
Sanity Studio Support
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I started this discussion in slack but that seems to be going nowhere so reaching out here.
We have a blog that we are migrating to Sanity with over 1000 blog posts. We need to have created and modified dates on these for SEO, sorting, and presentation purposes. When importing, we have the
_createdAt
and_updatedAt
fields set in our NDJSON entries. It seems as though created at is respected while updated at is not. There appears to be no way to import anything with the updated at field respected.So, this has a couple of implications:
_updatedAt
for reliable last modified times_updatedAt
values would be lost when a dataset is restored from a backup, further lending credibility to not relying on them_updatedAt
values would be lostSo, then our only option is to have a second field that we utilize for the last modified time. But this has some complications as well.
How do we ensure this is up to date? This puts additional work on content creators to maintain an additional field. It does add some flexibility technically since this is now not directly tied to edits, allowing for overriding the true modified date.
Perhaps a custom document action? Oh but these do not run when a publish is scheduled - they would only run when the actual publish button is pushed.
Speaking of scheduled publishing... It is now up to the content creators to ensure that the updatedAt date is at or after the scheduled publish since none of our validation would be able to run on a scheduled publish?
OR we don't give them the flexibility to alter this and use a groq webhook to maintain this field - meaning additional expense for server time, development time, maintenance, debugging, updating all so we can actually just have a field that represents the time a document was modified?
Beta Was this translation helpful? Give feedback.
All reactions