From d6fe6446a5b2a3d6393dda33445f211968086bf0 Mon Sep 17 00:00:00 2001 From: tobias Date: Mon, 24 Jun 2024 01:22:01 +0200 Subject: [PATCH] Add posts --- payload.config.ts | 2 +- src/app/(app)/page.tsx | 20 +++-- src/app/(app)/posts/[[...path]]/page.tsx | 36 +++++++++ src/app/(payload)/collections/Posts.ts | 87 ++++++--------------- src/app/(payload)/collections/config.ts | 1 + src/components/Blocks/Posts.tsx | 32 ++++++++ src/components/Footer.tsx | 15 ++++ src/components/PostEntry.tsx | 41 ++++++++++ src/components/PostPage.tsx | 16 ++++ types/payload-types.ts | 96 +++++++++++++++--------- 10 files changed, 234 insertions(+), 112 deletions(-) create mode 100644 src/app/(app)/posts/[[...path]]/page.tsx create mode 100644 src/components/Blocks/Posts.tsx create mode 100644 src/components/Footer.tsx create mode 100644 src/components/PostEntry.tsx create mode 100644 src/components/PostPage.tsx diff --git a/payload.config.ts b/payload.config.ts index 08ab6d1..9755ad6 100644 --- a/payload.config.ts +++ b/payload.config.ts @@ -33,6 +33,7 @@ const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) export default buildConfig({ + collections: [Users, Posts, Authors, Media, Pages], admin: { autoLogin: { email: 'dev@payloadcms.com', @@ -41,7 +42,6 @@ export default buildConfig({ }, }, editor: lexicalEditor(), - collections: [Users, Posts, Authors, Media, Pages], secret: process.env.PAYLOAD_SECRET || '', typescript: { outputFile: path.resolve(dirname, 'types/payload-types.ts'), diff --git a/src/app/(app)/page.tsx b/src/app/(app)/page.tsx index 5d3b22e..59e524e 100644 --- a/src/app/(app)/page.tsx +++ b/src/app/(app)/page.tsx @@ -1,8 +1,11 @@ -import ThemeSwitcher from '@/components/ThemeSwitcher' -import { getCurrentYear } from '@/utils/date' import Link from 'next/link' import React from 'react' import Header from '@/components/Header' +import Footer from '@/components/Footer' + +import { getPayloadHMR } from '@payloadcms/next/utilities' +import configPromise from '@payload-config' +import Posts from '@/components/Blocks/Posts' interface Props {} @@ -17,16 +20,11 @@ const Page = (props: Props) => {
{`When you're ready to deploy the website on your own server, Nextload comes with a production environment that requires the use of Traefik as a reverse proxy. This setup provides a secure and scalable production environment for your website.`}

- {/*
- -
*/} +
+ +
- +