简体   繁体   English

Strapi - 获取上次内容更改日期

[英]Strapi - get last content changed date

I'm building a website and would like to use strapi CMS as the backend.我正在建立一个网站,并希望使用strapi CMS 作为后端。 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.由于我的网站将使用 Gatsby 构建,因此如果内容发生变化,我计划每天使用服务器上的 cron 任务来构建网站。

Is there a functionality in Strapi that let me retrieve the last content changed date? Strapi 中是否有可以让我检索上次内容更改日期的功能? 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.遗憾的是,我无法使用 webhook,因为我被迫进入 PLESK 控制面板。

Indeed, there is a functionality to achieve this in all CMS, they are called webhooks.事实上,在所有 CMS 中都有一个功能可以实现这一点,它们被称为 webhook。 Some CMS added the functionality (but only under gatsby development , like DatoCMS does).一些 CMS 添加了该功能(但仅在gatsby development下,就像 DatoCMS 一样)。 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.添加 webhook 比创建每天构建的 cron 作业效率更高,因为如果没有新的或编辑过的内容,它可能会导致不必要的部署,并且可能会导致很大的延迟,直到将内容添加到部署的内容中。

According to Strapi's documentation:根据 Strapi 的文档:

A webhook is a way for an application to notify other applications that an event occurred. Webhook 是应用程序通知其他应用程序发生事件的一种方式。 Using a webhook is a good way to tell third party providers to start some processing (CI, build, deployment...).使用 webhook 是告诉第三方提供商开始一些处理(CI、构建、部署......)的好方法。

The way a webhook works is by delivering information to a receiving application through HTTP requests (typically POST requests). Webhook 的工作方式是通过 HTTP 请求(通常是POST请求)将信息传递给接收应用程序。

You may find this guide interesting .您可能会发现本指南很有趣 It shows you step by step how to create a webhook in your CD system.它逐步向您展示如何在您的 CD 系统中创建 webhook。


Sadly, I can't use webhooks because I'm forced into a PLESK control panel.遗憾的是,我无法使用 webhook,因为我被迫进入 PLESK 控制面板。

In this case, since Plesk does only accept GitHub webhooks, you are forced to choose your cron implementation.在这种情况下,由于 Plesk 只接受 GitHub webhook,您不得不选择您的 cron 实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM