Strapi - get last content changed date

Viewed 722

I'm building a website and would like to use strapi CMS as the backend. Since my website will be built with Gatsby, I planned of using a cron task on the server to build the website every day, if the content has changed.

Is there a functionality in Strapi that let me retrieve the last content changed date? Or should I create it myself (if it's possible)?

EDIT:

Sadly, I can't use webhooks because I'm forced into a PLESK control panel.

1 Answers

Indeed, there is a functionality to achieve this in all CMS, they are called webhooks. Some CMS added the functionality (but only under gatsby development, like DatoCMS does). Adding a webhook is much more efficient than creating a cron job to build each day, since it may cause unnecessary deploys if there isn't new or edited content and may cause big delays until the content is added to the content is deployed.

According to Strapi's documentation:

A webhook is a way for an application to notify other applications that an event occurred. Using a webhook is a good way to tell third party providers to start some processing (CI, build, deployment ...).

The way a webhook works is by delivering information to a receiving application through HTTP requests (typically POST requests).

You may find this guide interesting. It shows you step by step how to create a webhook in your CD system.


Sadly, I can't use webhooks because I'm forced into a PLESK control panel.

In this case, since Plesk does only accept GitHub webhooks, you are forced to choose your cron implementation.

Related