starting to understand payload

This commit is contained in:
2025-10-10 11:51:38 -04:00
parent 343889da93
commit b8c545271a
9 changed files with 193 additions and 72 deletions

View File

@@ -1,11 +1,13 @@
import { headers as getHeaders } from 'next/headers.js'
import Image from 'next/image'
import { getPayload } from 'payload'
import type { Payload } from 'payload'
import React from 'react'
import { fileURLToPath } from 'url'
import config from '@/payload.config'
import './styles.css'
import { RichText } from '@payloadcms/richtext-lexical/react'
export default async function HomePage() {
const headers = await getHeaders()
@@ -15,9 +17,26 @@ export default async function HomePage() {
const fileURL = `vscode://file/${fileURLToPath(import.meta.url)}`
const homePage = await payload.find({
collection: 'pages',
where: {
title: {
equals: 'Home',
},
},
})
const page = homePage.docs?.[0]
console.log(page)
return (
<div className="home">
<div className="content">
<div className="">
<h1 className='text-4xl font-bold'>{page.title}</h1>
{page.richText && (
<RichText data={page.richText}/>
)}
<picture>
<source srcSet="https://raw.githubusercontent.com/payloadcms/payload/main/packages/ui/src/assets/payload-favicon.svg" />
<Image