Update welcome post content and formatting; implement dynamic blog owner name in layout and post metadata; add author field to post structure and API routes.

This commit is contained in:
rattatwinko
2025-06-17 16:26:43 +02:00
parent dfe3e28dab
commit a1e4238435
8 changed files with 80 additions and 30 deletions

View File

@@ -22,6 +22,7 @@ export async function POST(request: Request) {
date,
tags,
summary,
author: process.env.NEXT_PUBLIC_BLOG_OWNER + "'s" || 'Anonymous',
});
// Write the file

View File

@@ -44,6 +44,7 @@ export async function POST(request: Request) {
date: data.date || new Date().toISOString().split('T')[0],
tags: data.tags || [],
summary: data.summary || '',
author: process.env.NEXT_PUBLIC_BLOG_OWNER + "'s" || 'Anonymous',
});
} catch (error) {
console.error('Error uploading file:', error);

View File

@@ -39,6 +39,7 @@ async function getPostBySlug(slug: string) {
summary: data.summary,
content: processedContent.toString(),
createdAt: createdAt.toISOString(),
author: process.env.NEXT_PUBLIC_BLOG_OWNER + "'s" || 'Anonymous',
};
}

View File

@@ -9,9 +9,11 @@ import HeaderButtons from './HeaderButtons';
const inter = Inter({ subsets: ['latin'] });
const blogOwner = process.env.NEXT_PUBLIC_BLOG_OWNER || 'Anonymous';
export const metadata: Metadata = {
title: 'Sebastian Zinkls - Blog',
description: 'Ein Blog von Sebastian Zinkl, gebaut mit Next.js und Markdown',
title: `${blogOwner}'s Blog`,
description: `Ein Blog von ${blogOwner}, gebaut mit Next.js und Markdown`,
};
const PersonIcon = (

View File

@@ -87,7 +87,7 @@ export default function Home() {
return (
<main className="min-h-screen p-8 max-w-4xl mx-auto">
<h1 className="text-4xl font-bold mb-8">Sebastian Zinkls - Blog</h1>
<h1 className="text-4xl font-bold mb-8">{process.env.NEXT_PUBLIC_BLOG_OWNER + "'s" || 'Anonymous'} - Blog</h1>
<nav className="mb-6 text-sm text-gray-600 flex gap-2 items-center">
{breadcrumbs.map((bc, idx) => (
<span key={bc.path.join('/') + idx}>
@@ -148,6 +148,7 @@ export default function Home() {
</div>
);
})()}
<hr className="border-t border-gray-200 my-8" />
<div className="grid gap-8">
{/* Folders */}
{nodes.filter((n) => n.type === 'folder').map((folder: any) => (

View File

@@ -18,6 +18,7 @@ export interface Post {
summary: string;
content: string;
createdAt: Date;
author: string;
}
const postsDirectory = path.join(process.cwd(), 'posts');
@@ -50,6 +51,7 @@ export async function getPostBySlug(slug: string): Promise<Post> {
summary: data.summary,
content: processedContent.toString(),
createdAt,
author: process.env.NEXT_PUBLIC_BLOG_OWNER || 'Anonymous',
};
}