@nuxt/content はgitベースのCMS。
マークダウンで書くことができ、個人ブログ程度であればheadless CMSより手軽に更新できるため重宝している。
しかし、Netlifyなどにデプロイした時、記事が内部的に持っているcreatedAt, updatedAtがリセットされてしまう問題が発生。
nuxt-content-git をインストールする。
npm install nuxt-content-git
nuxt.config.jsのmodulesに以下のように記述
export default {
modules: [
'nuxt-content-git',
'@nuxt/content',
],
}
next-content-gitは必ず@nuxt/contentの前に記述すること。
これでデプロイすると、createdAt, updatedAtが正しく設定されている。