feat: implement SEO enhancements, automatic slug generation, and font optimizations
All checks were successful
Build and Push App / build (push) Successful in 9m12s

This commit is contained in:
streap2
2026-04-26 08:11:31 +02:00
parent 3c58e60b33
commit d1e551bcca
16 changed files with 564 additions and 896 deletions

View File

@@ -27,6 +27,10 @@ export async function PATCH(
try {
const { id } = await context.params
const body = await request.json()
if (body.title && body.slug === undefined) {
const { generateSlug } = await import('@/lib/utils')
body.slug = generateSlug(body.title)
}
const post = await prisma.blogPost.update({ where: { id }, data: body })
return NextResponse.json(post)
} catch (error) {

View File

@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from 'next/server'
import prisma from '@/lib/prisma'
import { generateSlug } from '@/lib/utils'
// GET /api/blog
export async function GET() {
@@ -18,6 +19,9 @@ export async function GET() {
export async function POST(request: NextRequest) {
try {
const body = await request.json()
if (!body.slug && body.title) {
body.slug = generateSlug(body.title)
}
const post = await prisma.blogPost.create({ data: body })
return NextResponse.json(post, { status: 201 })
} catch (error) {