networkteam/neos-next

为 Neos CMS 添加 Next.js 支持

v0.5.0 2024-03-07 14:54 UTC

This package is auto-updated.

Last update: 2024-09-07 16:03:47 UTC


README

本包为 Neos CMS 添加了对 Next.js 的特殊支持。

  • 通过 Next.js 前端提供节点(也称为独立渲染)的预览渲染
  • 向 Next.js 发送更改的文档节点的重新验证请求

注意:请确保在您的 Next.js 项目中添加 @networkteam/zebra

实际内容将通过 Networkteam.Neos.ContentApi 包提供给 Next.js。

为什么有两个包?

Networkteam.Neos.ContentApi 是一个更通用的包,用于从 Neos CMS 以 JSON 格式获取内容,并通过 Fusion 进行配置。它不仅针对 Next.js,还可以用于其他用例。

配置

Neos CMS 需要知道 Next.js 的 URL 才能正确工作。默认配置适用于本地 Next.js 服务器。

Networkteam:
  Neos:
    Next:
      # Configure Next.js setting by site node name
      sites:
        # The default settings are used for all sites without a specific configuration
        _default:
          # The base URL for the Next.js frontend
          nextBaseUrl: http://localhost:3000/

          revalidate:
            # The URI for revalidation could be a path or an absolute URL
            uri: '/api/revalidate'
            token: 'a-secret-token'

        # Add additional site configurations by site node name
        #
        # mySiteNode:
        #   nextBaseUrl: http://my-site.local:3000/

注意:生产配置应使用一个长的随机令牌。

许可证

MIT