Is your feature request related to a problem? Please describe.
I'm building a sitemap generator for a site, and understand that including the publish date for articles can help with SEO on more recent posts. Currently it looks like this would have to be entered manually for each post.
Describe the solution you'd like
I'm wondering if it's possible to expose a config option or a widget that would automatically add the date to a post, and keep it updated on every publish.
Describe alternatives you've considered
Additional context
Hi, @neefrehman! I am new to Netlify CMS, but It looks like a valid case for registering-to-cms-events. Not tested it, but something like
CMS.registerEventListener({
name: 'preSave'
handler: ({ entry }) => {
return entry.get('data').set('lastEdited', new Date().toISOString())
},
});
should do the trick. We also should set a 'lastEdited' as hidden field, I think.
@TimPchelintsev thanks! this is exactly the kind of solution I was looking for!
Most helpful comment
Hi, @neefrehman! I am new to Netlify CMS, but It looks like a valid case for registering-to-cms-events. Not tested it, but something like
should do the trick. We also should set a 'lastEdited' as hidden field, I think.