Claude Code के साथ Blog CMS कैसे बनाएं
Claude Code का उपयोग करके blog CMS बनाना सीखें। Practical code examples और step-by-step guidance शामिल है।
Claude Code से Blog CMS बनाएं
अपना खुद का blog CMS रखने से design freedom, SEO control, और performance optimization पर पूरा control मिलता है। Claude Code का उपयोग करके, article management, preview, और publishing workflow वाला CMS कम समय में बनाया जा सकता है।
Prompt Design
> Next.js App Router से blog CMS बनाओ।
> Markdown articles create, edit, publish कर सकने वाली admin panel और
> SSG से generate होने वाला frontend दोनों बनाओ।
> Category और tags से filtering भी implement करो।
Article Data Model Definition
// src/types/post.ts
export interface Post {
id: string;
title: string;
slug: string;
content: string; // Markdown
excerpt: string;
coverImage?: string;
category: string;
tags: string[];
status: 'draft' | 'published' | 'archived';
publishedAt?: Date;
createdAt: Date;
updatedAt: Date;
authorId: string;
}
export interface PostCreateInput {
title: string;
content: string;
category: string;
tags: string[];
status?: 'draft' | 'published';
}
Article Management API Implementation
// src/app/api/posts/route.ts
import { NextRequest, NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';
import { generateSlug } from '@/lib/utils';
export async function GET(request: NextRequest) {
const { searchParams } = new URL(request.url);
const category = searchParams.get('category');
const tag = searchParams.get('tag');
const status = searchParams.get('status') || 'published';
const posts = await prisma.post.findMany({
where: {
status,
...(category && { category }),
...(tag && { tags: { has: tag } }),
},
orderBy: { publishedAt: 'desc' },
select: {
id: true,
title: true,
slug: true,
excerpt: true,
category: true,
tags: true,
publishedAt: true,
coverImage: true,
},
});
return NextResponse.json(posts);
}
export async function POST(request: NextRequest) {
const body = await request.json();
const slug = generateSlug(body.title);
const post = await prisma.post.create({
data: {
...body,
slug,
excerpt: body.content.substring(0, 160),
publishedAt: body.status === 'published' ? new Date() : null,
},
});
return NextResponse.json(post, { status: 201 });
}
Markdown Editor Component
// src/components/admin/MarkdownEditor.tsx
'use client';
import { useState } from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
interface Props {
initialContent?: string;
onSave: (content: string) => void;
}
export function MarkdownEditor({ initialContent = '', onSave }: Props) {
const [content, setContent] = useState(initialContent);
const [isPreview, setIsPreview] = useState(false);
return (
<div className="border rounded-lg">
<div className="flex border-b">
<button
onClick={() => setIsPreview(false)}
className={`px-4 py-2 ${!isPreview ? 'bg-blue-50 font-bold' : ''}`}
>
Edit
</button>
<button
onClick={() => setIsPreview(true)}
className={`px-4 py-2 ${isPreview ? 'bg-blue-50 font-bold' : ''}`}
>
Preview
</button>
</div>
{isPreview ? (
<div className="prose p-4 max-w-none">
<ReactMarkdown remarkPlugins={[remarkGfm]}>{content}</ReactMarkdown>
</div>
) : (
<textarea
value={content}
onChange={(e) => setContent(e.target.value)}
className="w-full h-96 p-4 font-mono text-sm resize-none"
placeholder="Markdown में article लिखें..."
/>
)}
<div className="flex justify-end p-3 border-t">
<button
onClick={() => onSave(content)}
className="bg-blue-600 text-white px-6 py-2 rounded"
>
Save
</button>
</div>
</div>
);
}
SEO Metadata Auto-Generation
Claude Code से request करने पर article content से OGP image auto-generation और meta tags setup भी implement किया जा सकता है।
// src/lib/seo.ts
export function generatePostMeta(post: Post) {
return {
title: `${post.title} | MyBlog`,
description: post.excerpt,
openGraph: {
title: post.title,
description: post.excerpt,
type: 'article',
publishedTime: post.publishedAt?.toISOString(),
tags: post.tags,
images: post.coverImage ? [{ url: post.coverImage }] : [],
},
};
}
Related Articles
CMS construction के frontend part के लिए SSR/SSG Comparison Guide helpful है। SEO measures के लिए SEO Optimization भी check करें।
Markdown processing library selection के लिए unified.js ecosystem comprehensive है और reference के रूप में useful है।
मुफ़्त PDF: 5 मिनट में Claude Code चीटशीट
बस अपना ईमेल दर्ज करें और हम तुरंत A4 एक-पृष्ठ चीटशीट PDF भेज देंगे।
हम आपकी व्यक्तिगत जानकारी की सुरक्षा करते हैं और स्पैम नहीं भेजते।
लेखक के बारे में
Masa
Claude Code का गहराई से उपयोग करने वाले इंजीनियर। claudecode-lab.com चलाते हैं, जो 10 भाषाओं में 2,000 से अधिक पेजों वाला टेक मीडिया है।
संबंधित लेख
हर दिन बहुभाषी Claude Code लेख प्रकाशित करने से पहले 7 जांचें
एक व्यावहारिक चेकलिस्ट ताकि आप हर दिन बहुभाषी Claude Code लेख प्रकाशित करते समय कोई भाषा न छोड़ें, CTA न तोड़ें और पुराना पेज लाइव न रहने दें।
Codex Automations क्या है? AI से content ops, analysis और deploy करवाने का तरीका
Codex Automations से analytics, article planning, CTA सुधार, deploy और monetization workflow चलाने की practical guide.
Claude Code × GCP Cloud Functions संपूर्ण गाइड | सर्वरलेस फंक्शन तेज़ी से विकसित करें
Claude Code से GCP Cloud Functions को ऑप्टिमाइज़ करें। HTTP/Pub/Sub/Firestore ट्रिगर, लोकल टेस्टिंग और डिप्लॉयमेंट ऑटोमेशन — Masa के व्यावहारिक अनुभव से रियल कोड उदाहरणों के साथ।