0.3.2 • Published 8 months ago
@contentql/core v0.3.2
ContentQL Core
@contentql/core
gives configuration which is ready to build a
content-oriented, blog website you can add this to your payload existing
project.
Getting Started
Example Usage
Add this code in your payload.config.ts
file to get a base configuration
import { cqlConfig } from '@contentql/core'
import path from 'path'
import { fileURLToPath } from 'url'
// payload block-configuration files
import DetailsConfig from '@/payload/blocks/Details/config'
import HomeConfig from '@/payload/blocks/Home/config'
import ListConfig from '@/payload/blocks/List/config'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
const finalPath = path.resolve(dirname, 'payload-types.ts')
// Add the extra payload configuration you want!
export default cqlConfig({
// baseURL is required for Live-Preview & SEO generation
baseUrl: 'http://localhost:3000',
dbURL: process.env.DATABASE_URI,
s3: {
bucket: process.env.S3_BUCKET,
accessKeyId: process.env.S3_ACCESS_KEY_ID,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
region: process.env.S3_REGION,
endpoint: process.env.S3_ENDPOINT,
},
typescript: {
outputFile: finalPath,
},
secret: process.env.PAYLOAD_SECRET,
cors: [process.env.PAYLOAD_URL],
csrf: [process.env.PAYLOAD_URL],
resend: {
apiKey: process.env.RESEND_API_KEY,
defaultFromAddress: process.env.RESEND_SENDER_EMAIL,
defaultFromName: process.env.RESEND_SENDER_NAME,
},
// pass the configuration to blocks field these will appear in pages collection in admin panel
blocks: [HomeConfig, DetailsConfig, ListConfig],
})
Slug Access
You can access the slugs of collections by using this import
// This will provide the slugs of all collections
import { collectionSlug } from '@contentql/core'
const { docs } = await payload.find({
collection: collectionSlug['blogs'],
depth: 5,
draft: false,
})
📦Out of box contents
Collections
These collections will be automatically added
- users
- pages
- blogs
- tags
- media
- site-settings
Plugins
These plugins will be automatically added
@payloadcms/plugin-nested-docs
,@payloadcms/plugin-seo
,@payloadcms/plugin-form-builder
- These plugins are enabled for
pages
collection
- These plugins are enabled for
scheduleDocPlugin
- This is our custom plugin which will provide an option to schedule the publish of a document
- It's enabled to
blogs
collection you can extend it but passing your own options inschedulePluginOptions
parameter incqlConfig
@payloadcms/plugin-search
- Search plugin is by-default enabled for blogs, tags, users collections
- you can extend it by passing your own options in
searchPluginOptions
parameter incqlConfig
📔Note
- You can add new fields to the existing Collections or Globals but can't modify existing fields
- radio, select field-type accept options parameter as
OptionObject[]
, we added this to support the merging of configuration
{
name: "role",
type: "select",
options: [
{
label: "Admin",
value: "admin",
},
{
label: "Author",
value: "author",
},
{
label: "User",
value: "user",
},
// editor -> ️️string is not allowed
],
saveToJWT: true,
defaultValue: "user",
required: true,
},
💅Admin Panel styles
// Add this import in the layout.tsx or page.tsx of payload admin panel
import '@contentql/core/styles'
0.3.2
8 months ago
0.3.1
8 months ago
0.3.0
8 months ago
0.2.1
9 months ago
0.2.7
8 months ago
0.2.6
8 months ago
0.2.9
8 months ago
0.2.8
8 months ago
0.2.3
9 months ago
0.2.2
9 months ago
0.2.5
8 months ago
0.2.4
9 months ago
0.2.0
9 months ago
0.1.10
9 months ago
0.1.9
9 months ago
0.1.8
9 months ago
0.1.7
9 months ago
0.1.6
9 months ago
0.1.5
9 months ago
0.1.4
9 months ago
0.1.3
9 months ago
0.1.2
9 months ago