Replaced contentlayer with keystatic

This commit is contained in:
giancarlo
2024-04-10 14:52:18 +08:00
parent f729bf6077
commit 006c4d430f
37 changed files with 2842 additions and 2776 deletions

View File

@@ -8,7 +8,10 @@ NEXT_PUBLIC_THEME_COLOR="#ffffff"
NEXT_PUBLIC_THEME_COLOR_DARK="#0a0a0a"
# CMS
CMS_CLIENT=contentlayer
CMS_CLIENT=keystatic
# KEYSTATIC
NEXT_PUBLIC_KEYSTATIC_CONTENT_PATH=./content
# AUTH
NEXT_PUBLIC_AUTH_PASSWORD=true

View File

@@ -4,9 +4,10 @@ import { notFound } from 'next/navigation';
import { createCmsClient } from '@kit/cms';
import { Post } from '~/(marketing)/blog/_components/post';
import { withI18n } from '~/lib/i18n/with-i18n';
import { Post } from '../../blog/_components/post';
export async function generateMetadata({
params,
}: {

View File

@@ -21,6 +21,7 @@ export function PostPreview({
}: React.PropsWithChildren<Props>) {
const { title, image, publishedAt, description } = post;
const height = imageHeight ?? DEFAULT_IMAGE_HEIGHT;
const slug = `/blog/${post.slug}`;
return (

View File

@@ -6,7 +6,7 @@ import { PostHeader } from './post-header';
export const Post: React.FC<{
post: Cms.ContentItem;
content: string;
content: unknown;
}> = ({ post, content }) => {
return (
<div>

View File

@@ -0,0 +1,8 @@
---
title: hello
description: hello
categories: ['blog']
tags: []
---
ddfdsfjsdnfjdks

View File

@@ -5,10 +5,12 @@
export async function register() {
// only run in nodejs runtime
if (process.env.NEXT_RUNTIME === 'nodejs') {
const { registerInstrumentation } = await import('@kit/monitoring');
const { registerMonitoringInstrumentation } = await import(
'@kit/monitoring'
);
// Register monitoring instrumentation based on the
// MONITORING_INSTRUMENTATION_PROVIDER environment variable.
return registerInstrumentation();
return registerMonitoringInstrumentation();
}
}

View File

@@ -66,7 +66,7 @@
"@kit/tsconfig": "workspace:^",
"@next/bundle-analyzer": "14.2.0-canary.54",
"@types/mdx": "^2.0.12",
"@types/node": "^20.12.3",
"@types/node": "^20.12.7",
"@types/react": "^18.2.75",
"@types/react-dom": "^18.2.22",
"autoprefixer": "^10.4.19",