mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 14:49:10 +03:00
* add cms turbo app * add cms scripts to package.json * update README * update README * update files * fix formatting * fix populateAuthors * sync dependencies * update launch week field * update lint config * Coordinate the deps to be the same as the other apps. * Remove extra files. * Run prettier on the CMS files. * Add commands for cleaning and typechecking. * Fix weird version of @types/react in docs. * run pnpm install * fix pnpm-lock * fix cms lint --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
88 lines
2.6 KiB
TypeScript
88 lines
2.6 KiB
TypeScript
import { payloadCloudPlugin } from '@payloadcms/payload-cloud'
|
|
// import { formBuilderPlugin } from '@payloadcms/plugin-form-builder'
|
|
import { nestedDocsPlugin } from '@payloadcms/plugin-nested-docs'
|
|
import { seoPlugin } from '@payloadcms/plugin-seo'
|
|
import { s3Storage } from '@payloadcms/storage-s3'
|
|
import { Plugin } from 'payload'
|
|
import { GenerateTitle, GenerateURL } from '@payloadcms/plugin-seo/types'
|
|
// import { FixedToolbarFeature, HeadingFeature, lexicalEditor } from '@payloadcms/richtext-lexical'
|
|
|
|
import { Customer, Event, Post } from '@/payload-types'
|
|
import { getServerSideURL } from '@/utilities/getURL'
|
|
|
|
const siteName = 'Supabase'
|
|
|
|
const generateTitle: GenerateTitle<Post & Customer & Event> = ({ doc, collectionSlug }) => {
|
|
switch (collectionSlug) {
|
|
case 'customers':
|
|
return `${doc.name} | ${siteName} Customer Stories`
|
|
case 'events':
|
|
return `${doc.title} | ${siteName} Events`
|
|
case 'posts':
|
|
return doc.title
|
|
default:
|
|
return `${doc.title} | ${siteName}`
|
|
}
|
|
}
|
|
|
|
const generateURL: GenerateURL<Post> = ({ doc }) => {
|
|
const url = getServerSideURL()
|
|
|
|
return doc?.slug ? `${url}/${doc.slug}` : url
|
|
}
|
|
|
|
export const plugins: Plugin[] = [
|
|
nestedDocsPlugin({
|
|
collections: ['categories'],
|
|
generateURL: (docs) => docs.reduce((url, doc) => `${url}/${doc.slug}`, ''),
|
|
}),
|
|
seoPlugin({
|
|
generateTitle,
|
|
generateURL,
|
|
}),
|
|
// formBuilderPlugin({
|
|
// fields: {
|
|
// payment: false,
|
|
// },
|
|
// formOverrides: {
|
|
// fields: ({ defaultFields }) => {
|
|
// return defaultFields.map((field) => {
|
|
// if ('name' in field && field.name === 'confirmationMessage') {
|
|
// return {
|
|
// ...field,
|
|
// editor: lexicalEditor({
|
|
// features: ({ rootFeatures }) => {
|
|
// return [
|
|
// ...rootFeatures,
|
|
// FixedToolbarFeature(),
|
|
// HeadingFeature({ enabledHeadingSizes: ['h1', 'h2', 'h3', 'h4'] }),
|
|
// ]
|
|
// },
|
|
// }),
|
|
// }
|
|
// }
|
|
// return field
|
|
// })
|
|
// },
|
|
// },
|
|
// }),
|
|
payloadCloudPlugin(),
|
|
s3Storage({
|
|
collections: {
|
|
media: {
|
|
prefix: 'media',
|
|
},
|
|
},
|
|
bucket: process.env.S3_BUCKET || '',
|
|
config: {
|
|
forcePathStyle: true,
|
|
credentials: {
|
|
accessKeyId: process.env.S3_ACCESS_KEY_ID || '',
|
|
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY || '',
|
|
},
|
|
region: process.env.S3_REGION,
|
|
endpoint: process.env.S3_ENDPOINT,
|
|
},
|
|
}),
|
|
]
|