diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8012d5e4466..c177ba2330f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1701,7 +1701,7 @@ importers: version: 16.9.0 next: specifier: 15.3.2 - version: 15.3.2(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) + version: 15.3.2(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.1.0-rc.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) payload: specifier: workspace:* version: link:../../packages/payload @@ -1822,7 +1822,7 @@ importers: version: 16.4.7 geist: specifier: ^1.3.0 - version: 1.4.2(next@15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)) + version: 1.4.2(next@15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)) graphql: specifier: ^16.8.1 version: 16.9.0 @@ -1831,13 +1831,13 @@ importers: version: 0.378.0(react@19.1.0) next: specifier: 15.3.3 - version: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) + version: 15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) next-sitemap: specifier: ^4.2.3 - version: 4.2.3(next@15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)) + version: 4.2.3(next@15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)) payload: - specifier: workspace:* - version: link:../../packages/payload + specifier: 3.48.0 + version: 3.48.0(bufferutil@4.0.8)(graphql@16.9.0)(typescript@5.7.3)(utf-8-validate@6.0.5) prism-react-renderer: specifier: ^2.3.1 version: 2.4.1(react@19.1.0) @@ -5046,6 +5046,9 @@ packages: cpu: [x64] os: [win32] + '@payloadcms/translations@3.48.0': + resolution: {integrity: sha512-YFEEyrCWK96q8uZ0OK9SU80ywSqc0S3dh+vAfI4mPzs2OPG//CHgbtz1d5X1r3e7A7CY/MzzGMVgf++fmRz2gQ==} + '@petamoriken/float16@3.9.2': resolution: {integrity: sha512-VgffxawQde93xKxT3qap3OH+meZf7VaSB5Sqd4Rqc+FP5alWbpOyan/7tRbOAvynjpG3GpdtAuGU/NdhQpmrog==} @@ -7401,6 +7404,10 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true + croner@9.0.0: + resolution: {integrity: sha512-onMB0OkDjkXunhdW9htFjEhqrD54+M94i6ackoUkjHKbRnXdyEyKRelp4nJ1kAz32+s27jP1FsebpJCVl0BsvA==} + engines: {node: '>=18.0'} + croner@9.1.0: resolution: {integrity: sha512-p9nwwR4qyT5W996vBZhdvBCnMhicY5ytZkR4D1Xj0wuTDEiMnjwR57Q3RXYY/s0EpX6Ay3vgIcfaR+ewGHsi+g==} engines: {node: '>=18.0'} @@ -10291,6 +10298,13 @@ packages: resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} engines: {node: '>= 14.16'} + payload@3.48.0: + resolution: {integrity: sha512-4XG3fGI3Y7mYFz0hBShielwYsUCnI5ilmgBvRH6SZJ0sDUHsok3uTQn91QBRusRDjqk+Ml/dHpHWqSbZR/+GaQ==} + engines: {node: ^18.20.2 || >=20.9.0} + hasBin: true + peerDependencies: + graphql: ^16.8.1 + peek-readable@5.3.1: resolution: {integrity: sha512-GVlENSDW6KHaXcd9zkZltB7tCLosKB/4Hg0fqBJkAoBgYG2Tn1xtMgXtSUuMU9AK/gCm/tTdT8mgAeF4YNeeqw==} engines: {node: '>=14.16'} @@ -15947,6 +15961,10 @@ snapshots: '@oxc-resolver/binding-win32-x64-msvc@5.3.0': optional: true + '@payloadcms/translations@3.48.0': + dependencies: + date-fns: 4.1.0 + '@petamoriken/float16@3.9.2': optional: true @@ -16489,7 +16507,7 @@ snapshots: '@sentry/vercel-edge': 8.37.1 '@sentry/webpack-plugin': 2.22.6(webpack@5.96.1(@swc/core@1.11.29)) chalk: 3.0.0 - next: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) + next: 15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) resolve: 1.22.8 rollup: 3.29.5 stacktrace-parser: 0.1.10 @@ -18799,6 +18817,8 @@ snapshots: - supports-color - ts-node + croner@9.0.0: {} + croner@9.1.0: {} cross-env@7.0.3: @@ -20125,9 +20145,9 @@ snapshots: - encoding - supports-color - geist@1.4.2(next@15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)): + geist@1.4.2(next@15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)): dependencies: - next: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) + next: 15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) gel@2.0.1: dependencies: @@ -21912,13 +21932,13 @@ snapshots: transitivePeerDependencies: - supports-color - next-sitemap@4.2.3(next@15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)): + next-sitemap@4.2.3(next@15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4)): dependencies: '@corex/deepmerge': 4.0.43 '@next/env': 13.5.11 fast-glob: 3.3.2 minimist: 1.2.8 - next: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) + next: 15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) next@15.2.3(@babel/core@7.27.3)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.1.0-rc.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4): dependencies: @@ -21977,34 +21997,6 @@ snapshots: - '@babel/core' - babel-plugin-macros - next@15.3.2(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4): - dependencies: - '@next/env': 15.3.2 - '@swc/counter': 0.1.3 - '@swc/helpers': 0.5.15 - busboy: 1.6.0 - caniuse-lite: 1.0.30001720 - postcss: 8.4.31 - react: 19.1.0 - react-dom: 19.1.0(react@19.1.0) - styled-jsx: 5.1.6(@babel/core@7.27.4)(babel-plugin-macros@3.1.0)(react@19.1.0) - optionalDependencies: - '@next/swc-darwin-arm64': 15.3.2 - '@next/swc-darwin-x64': 15.3.2 - '@next/swc-linux-arm64-gnu': 15.3.2 - '@next/swc-linux-arm64-musl': 15.3.2 - '@next/swc-linux-x64-gnu': 15.3.2 - '@next/swc-linux-x64-musl': 15.3.2 - '@next/swc-win32-arm64-msvc': 15.3.2 - '@next/swc-win32-x64-msvc': 15.3.2 - '@opentelemetry/api': 1.9.0 - '@playwright/test': 1.50.0 - sass: 1.77.4 - sharp: 0.34.2 - transitivePeerDependencies: - - '@babel/core' - - babel-plugin-macros - next@15.3.2(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(babel-plugin-react-compiler@19.1.0-rc.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4): dependencies: '@next/env': 15.3.2 @@ -22034,7 +22026,7 @@ snapshots: - '@babel/core' - babel-plugin-macros - next@15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4): + next@15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4): dependencies: '@next/env': 15.3.3 '@swc/counter': 0.1.3 @@ -22362,6 +22354,45 @@ snapshots: pathval@2.0.0: {} + payload@3.48.0(bufferutil@4.0.8)(graphql@16.9.0)(typescript@5.7.3)(utf-8-validate@6.0.5): + dependencies: + '@next/env': 15.3.2 + '@payloadcms/translations': 3.48.0 + '@types/busboy': 1.5.4 + ajv: 8.17.1 + bson-objectid: 2.0.4 + busboy: 1.6.0 + ci-info: 4.1.0 + console-table-printer: 2.12.1 + croner: 9.0.0 + dataloader: 2.2.3 + deepmerge: 4.3.1 + file-type: 19.3.0 + get-tsconfig: 4.8.1 + graphql: 16.9.0 + http-status: 2.1.0 + image-size: 2.0.2 + ipaddr.js: 2.2.0 + jose: 5.9.6 + json-schema-to-typescript: 15.0.3 + minimist: 1.2.8 + path-to-regexp: 6.3.0 + pino: 9.5.0 + pino-pretty: 13.0.0 + pluralize: 8.0.0 + qs-esm: 7.0.2 + sanitize-filename: 1.6.3 + scmp: 2.1.0 + ts-essentials: 10.0.3(typescript@5.7.3) + tsx: 4.20.3 + undici: 7.10.0 + uuid: 10.0.0 + ws: 8.18.0(bufferutil@4.0.8)(utf-8-validate@6.0.5) + transitivePeerDependencies: + - bufferutil + - typescript + - utf-8-validate + peek-readable@5.3.1: {} pend@1.2.0: {} @@ -24321,7 +24352,7 @@ snapshots: '@uploadthing/shared': 7.1.1 effect: 3.10.3 optionalDependencies: - next: 15.3.3(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) + next: 15.3.3(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(@playwright/test@1.50.0)(babel-plugin-macros@3.1.0)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(sass@1.77.4) tailwindcss: 3.4.17 uri-js@4.4.1: diff --git a/templates/website/src/blocks/RenderBlocks.tsx b/templates/website/src/blocks/RenderBlocks.tsx index c84634a64ad..46f8d67ae27 100644 --- a/templates/website/src/blocks/RenderBlocks.tsx +++ b/templates/website/src/blocks/RenderBlocks.tsx @@ -7,6 +7,7 @@ import { CallToActionBlock } from '@/blocks/CallToAction/Component' import { ContentBlock } from '@/blocks/Content/Component' import { FormBlock } from '@/blocks/Form/Component' import { MediaBlock } from '@/blocks/MediaBlock/Component' +import { ReusableContentBlock } from '@/blocks/ReusableContent/Component' const blockComponents = { archive: ArchiveBlock, @@ -14,6 +15,7 @@ const blockComponents = { cta: CallToActionBlock, formBlock: FormBlock, mediaBlock: MediaBlock, + reusableContentBlock: ReusableContentBlock, } export const RenderBlocks: React.FC<{ diff --git a/templates/website/src/blocks/ReusableContent/Component.tsx b/templates/website/src/blocks/ReusableContent/Component.tsx new file mode 100644 index 00000000000..8b68b9e0a26 --- /dev/null +++ b/templates/website/src/blocks/ReusableContent/Component.tsx @@ -0,0 +1,28 @@ +import type { Page } from '@/payload-types' +import { RenderBlocks } from '@/blocks/RenderBlocks' +import React from 'react' + +export type Props = Extract + +export const ReusableContentBlock: React.FC = ({ reusableContentBlockFields }) => { + const { customId, reusableContent } = reusableContentBlockFields + + if ( + typeof reusableContent === 'object' && + reusableContent !== null && + 'layout' in reusableContent && + Array.isArray((reusableContent as { layout: unknown }).layout) + ) { + const layout = (reusableContent as { layout: Page['layout'] }).layout + + console.log('Resolved reusable layout:', layout) + + return ( +
+ +
+ ) + } + + return null +} diff --git a/templates/website/src/blocks/ReusableContent/config.ts b/templates/website/src/blocks/ReusableContent/config.ts new file mode 100644 index 00000000000..81cfa4126c8 --- /dev/null +++ b/templates/website/src/blocks/ReusableContent/config.ts @@ -0,0 +1,26 @@ +import type { Block } from 'payload' + +export const ReusableContent: Block = { + slug: 'reusableContentBlock', + fields: [ + { + name: 'reusableContentBlockFields', + type: 'group', + fields: [ + { + name: 'reusableContent', + type: 'relationship', + relationTo: 'reusable-content', + required: true, + }, + { + name: 'customId', + type: 'text', + admin: { + description: 'Custom ID for targeting with CSS/JS', + }, + }, + ], + }, + ], +} diff --git a/templates/website/src/collections/Pages/index.ts b/templates/website/src/collections/Pages/index.ts index c81ffa8815e..ed1a52085ba 100644 --- a/templates/website/src/collections/Pages/index.ts +++ b/templates/website/src/collections/Pages/index.ts @@ -7,6 +7,7 @@ import { CallToAction } from '../../blocks/CallToAction/config' import { Content } from '../../blocks/Content/config' import { FormBlock } from '../../blocks/Form/config' import { MediaBlock } from '../../blocks/MediaBlock/config' +import { ReusableContent } from '@/blocks/ReusableContent/config' import { hero } from '@/heros/config' import { slugField } from '@/fields/slug' import { populatePublishedAt } from '../../hooks/populatePublishedAt' @@ -75,7 +76,15 @@ export const Pages: CollectionConfig<'pages'> = { { name: 'layout', type: 'blocks', - blocks: [CallToAction, Content, MediaBlock, Archive, FormBlock], + blockReferences: [ + CallToAction, + Content, + Archive, + MediaBlock, + FormBlock, + ReusableContent, + ], + blocks: [], required: true, admin: { initCollapsed: true, diff --git a/templates/website/src/collections/ReusableContents.ts b/templates/website/src/collections/ReusableContents.ts new file mode 100644 index 00000000000..35f547b47dc --- /dev/null +++ b/templates/website/src/collections/ReusableContents.ts @@ -0,0 +1,37 @@ +import type { CollectionConfig } from 'payload' + +import { Archive } from '@/blocks/ArchiveBlock/config' +import { CallToAction } from '@/blocks/CallToAction/config' +import { Content } from '@/blocks/Content/config' +import { MediaBlock } from '@/blocks/MediaBlock/config' +import { FormBlock } from '@/blocks/Form/config' + +import { anyone } from '../access/anyone' +import { authenticated } from '../access/authenticated' + +export const ReusableContent: CollectionConfig = { + slug: 'reusable-content', + access: { + create: authenticated, + delete: authenticated, + read: anyone, + update: authenticated, + }, + admin: { + useAsTitle: 'title', + }, + fields: [ + { + name: 'title', + type: 'text', + required: true, + }, + { + name: 'layout', + type: 'blocks', + blockReferences: [CallToAction, Content, Archive, MediaBlock, FormBlock], + blocks: [], + required: true, + }, + ], +} diff --git a/templates/website/src/payload-types.ts b/templates/website/src/payload-types.ts index 8f61fdc6c62..31d0b3da33d 100644 --- a/templates/website/src/payload-types.ts +++ b/templates/website/src/payload-types.ts @@ -65,12 +65,19 @@ export interface Config { auth: { users: UserAuthOperations; }; - blocks: {}; + blocks: { + cta: CallToActionBlock; + content: ContentBlock; + archive: ArchiveBlock; + mediaBlock: MediaBlock; + formBlock: FormBlock; + }; collections: { pages: Page; posts: Post; media: Media; categories: Category; + 'reusable-content': ReusableContent; users: User; redirects: Redirect; forms: Form; @@ -87,6 +94,7 @@ export interface Config { posts: PostsSelect | PostsSelect; media: MediaSelect | MediaSelect; categories: CategoriesSelect | CategoriesSelect; + 'reusable-content': ReusableContentSelect | ReusableContentSelect; users: UsersSelect | UsersSelect; redirects: RedirectsSelect | RedirectsSelect; forms: FormsSelect | FormsSelect; @@ -141,6 +149,54 @@ export interface UserAuthOperations { password: string; }; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "CallToActionBlock". + */ +export interface CallToActionBlock { + richText?: { + root: { + type: string; + children: { + type: string; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + links?: + | { + link: { + type?: ('reference' | 'custom') | null; + newTab?: boolean | null; + reference?: + | ({ + relationTo: 'pages'; + value: string | Page; + } | null) + | ({ + relationTo: 'posts'; + value: string | Post; + } | null); + url?: string | null; + label: string; + /** + * Choose how the link should be rendered. + */ + appearance?: ('default' | 'outline') | null; + }; + id?: string | null; + }[] + | null; + id?: string | null; + blockName?: string | null; + blockType: 'cta'; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "pages". @@ -191,7 +247,25 @@ export interface Page { | null; media?: (string | null) | Media; }; - layout: (CallToActionBlock | ContentBlock | MediaBlock | ArchiveBlock | FormBlock)[]; + layout: ( + | CallToActionBlock + | ContentBlock + | ArchiveBlock + | MediaBlock + | FormBlock + | { + reusableContentBlockFields: { + reusableContent: string | ReusableContent; + /** + * Custom ID for targeting with CSS/JS + */ + customId?: string | null; + }; + id?: string | null; + blockName?: string | null; + blockType: 'reusableContentBlock'; + } + )[]; meta?: { title?: string | null; /** @@ -392,54 +466,6 @@ export interface User { | null; password?: string | null; } -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "CallToActionBlock". - */ -export interface CallToActionBlock { - richText?: { - root: { - type: string; - children: { - type: string; - version: number; - [k: string]: unknown; - }[]; - direction: ('ltr' | 'rtl') | null; - format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; - indent: number; - version: number; - }; - [k: string]: unknown; - } | null; - links?: - | { - link: { - type?: ('reference' | 'custom') | null; - newTab?: boolean | null; - reference?: - | ({ - relationTo: 'pages'; - value: string | Page; - } | null) - | ({ - relationTo: 'posts'; - value: string | Post; - } | null); - url?: string | null; - label: string; - /** - * Choose how the link should be rendered. - */ - appearance?: ('default' | 'outline') | null; - }; - id?: string | null; - }[] - | null; - id?: string | null; - blockName?: string | null; - blockType: 'cta'; -} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "ContentBlock". @@ -490,16 +516,6 @@ export interface ContentBlock { blockName?: string | null; blockType: 'content'; } -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "MediaBlock". - */ -export interface MediaBlock { - media: string | Media; - id?: string | null; - blockName?: string | null; - blockType: 'mediaBlock'; -} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "ArchiveBlock". @@ -534,6 +550,16 @@ export interface ArchiveBlock { blockName?: string | null; blockType: 'archive'; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "MediaBlock". + */ +export interface MediaBlock { + media: string | Media; + id?: string | null; + blockName?: string | null; + blockType: 'mediaBlock'; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "FormBlock". @@ -734,6 +760,17 @@ export interface Form { updatedAt: string; createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "reusable-content". + */ +export interface ReusableContent { + id: string; + title: string; + layout: (CallToActionBlock | ContentBlock | ArchiveBlock | MediaBlock | FormBlock)[]; + updatedAt: string; + createdAt: string; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "redirects". @@ -923,6 +960,10 @@ export interface PayloadLockedDocument { relationTo: 'categories'; value: string | Category; } | null) + | ({ + relationTo: 'reusable-content'; + value: string | ReusableContent; + } | null) | ({ relationTo: 'users'; value: string | User; @@ -1022,9 +1063,21 @@ export interface PagesSelect { | { cta?: T | CallToActionBlockSelect; content?: T | ContentBlockSelect; - mediaBlock?: T | MediaBlockSelect; archive?: T | ArchiveBlockSelect; + mediaBlock?: T | MediaBlockSelect; formBlock?: T | FormBlockSelect; + reusableContentBlock?: + | T + | { + reusableContentBlockFields?: + | T + | { + reusableContent?: T; + customId?: T; + }; + id?: T; + blockName?: T; + }; }; meta?: | T @@ -1090,15 +1143,6 @@ export interface ContentBlockSelect { id?: T; blockName?: T; } -/** - * This interface was referenced by `Config`'s JSON-Schema - * via the `definition` "MediaBlock_select". - */ -export interface MediaBlockSelect { - media?: T; - id?: T; - blockName?: T; -} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "ArchiveBlock_select". @@ -1113,6 +1157,15 @@ export interface ArchiveBlockSelect { id?: T; blockName?: T; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "MediaBlock_select". + */ +export interface MediaBlockSelect { + media?: T; + id?: T; + blockName?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "FormBlock_select". @@ -1268,6 +1321,24 @@ export interface CategoriesSelect { updatedAt?: T; createdAt?: T; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "reusable-content_select". + */ +export interface ReusableContentSelect { + title?: T; + layout?: + | T + | { + cta?: T | CallToActionBlockSelect; + content?: T | ContentBlockSelect; + archive?: T | ArchiveBlockSelect; + mediaBlock?: T | MediaBlockSelect; + formBlock?: T | FormBlockSelect; + }; + updatedAt?: T; + createdAt?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "users_select". diff --git a/templates/website/src/payload.config.ts b/templates/website/src/payload.config.ts index 2ddee86d2dc..97cda4c07d0 100644 --- a/templates/website/src/payload.config.ts +++ b/templates/website/src/payload.config.ts @@ -11,11 +11,17 @@ import { Media } from './collections/Media' import { Pages } from './collections/Pages' import { Posts } from './collections/Posts' import { Users } from './collections/Users' +import { ReusableContent } from './collections/ReusableContents' import { Footer } from './Footer/config' import { Header } from './Header/config' import { plugins } from './plugins' import { defaultLexical } from '@/fields/defaultLexical' import { getServerSideURL } from './utilities/getURL' +import { CallToAction } from '@/blocks/CallToAction/config' +import { Content } from '@/blocks/Content/config' +import { Archive } from '@/blocks/ArchiveBlock/config' +import { MediaBlock } from '@/blocks/MediaBlock/config' +import { FormBlock } from '@/blocks/Form/config' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) @@ -57,6 +63,7 @@ export default buildConfig({ ], }, }, + blocks: [CallToAction, Content, Archive, MediaBlock, FormBlock], // This config helps us configure global or default features that the other editors can inherit editor: defaultLexical, // database-adapter-config-start @@ -64,7 +71,7 @@ export default buildConfig({ url: process.env.DATABASE_URI, }), // database-adapter-config-end - collections: [Pages, Posts, Media, Categories, Users], + collections: [Pages, Posts, Media, Categories, ReusableContent, Users], cors: [getServerSideURL()].filter(Boolean), globals: [Header, Footer], plugins: [ @@ -72,7 +79,6 @@ export default buildConfig({ // storage-adapter-placeholder ], secret: process.env.PAYLOAD_SECRET, - sharp, typescript: { outputFile: path.resolve(dirname, 'payload-types.ts'), },