Blog System
Blog and content management system
Blog System
Chameleon includes a complete blog system with admin management interface and public display pages.
Overview
The blog system provides content management capabilities for creating, editing, and publishing blog posts. Admins can manage posts through the admin interface, while visitors can view posts on the public blog pages. The system supports Markdown content, multi-language posts, and SEO optimization.
Admin Interface
Access Blog Management
- Sign in as admin
- Go to
/admin/posts - View all blog posts
- Create, edit, or delete posts
Create New Post
- Click Add Post button
- Fill in post details:
- Title: Post title
- Description: Post summary
- Content: Markdown content
- Slug: URL-friendly identifier
- Language: English or Chinese
- Status: Draft or Published
- Click Save
Edit Existing Post
- Find the post in the list
- Click Edit button
- Modify content as needed
- Save changes
Public Blog Pages
Blog List Page
Location: /posts
Features:
- Display all published posts
- Pagination support
- Search functionality
- Language filtering
Individual Post Page
Location: /posts/[slug]
Features:
- Full post content
- Markdown rendering
- SEO meta tags
- Social sharing
Usage
Creating Blog Posts
// Admin interface at /admin/posts/add
const newPost = {
title: "My Blog Post",
description: "Post summary",
content: "# Hello World\n\nThis is my blog post content.",
slug: "my-blog-post",
language: "en",
status: "published"
};
Displaying Posts
// src/app/[locale]/(default)/posts/page.tsx
import { getPosts } from "@/models/post";
export default async function BlogPage() {
const posts = await getPosts({ status: "published" });
return (
<div>
{posts.map(post => (
<article key={post.uuid}>
<h2>{post.title}</h2>
<p>{post.description}</p>
<Link href={`/posts/${post.slug}`}>
Read More
</Link>
</article>
))}
</div>
);
}
Markdown Content
Posts support full Markdown syntax:
# Heading 1
## Heading 2
**Bold text** and *italic text*
- List item 1
- List item 2
[Link text](https://example.com)
```code block```
> Blockquote
File Locations
src/app/[locale]/(admin)/admin/posts/page.tsx- Admin post listsrc/app/[locale]/(admin)/admin/posts/add/page.tsx- Create new postsrc/app/[locale]/(admin)/admin/posts/[uuid]/edit/page.tsx- Edit postsrc/app/[locale]/(default)/posts/page.tsx- Public blog listsrc/app/[locale]/(default)/posts/[slug]/page.tsx- Individual post pagesrc/models/post.ts- Post data modelsrc/services/post.ts- Post business logic
Common Tasks
Publish a Post
- Create post in admin interface
- Set status to "Published"
- Save post
- Post appears on
/postspage
Update Post Content
- Go to
/admin/posts - Find the post
- Click Edit
- Modify content
- Save changes
Delete a Post
- Go to
/admin/posts - Find the post
- Click delete button
- Confirm deletion
SEO Optimization
Posts automatically include:
- Meta title and description
- OpenGraph tags
- Twitter Card tags
- Structured data
Troubleshooting
Post not appearing
Problem: Published post not showing on blog page
Solution:
- Check post status is "Published"
- Verify post language matches site language
- Clear cache and refresh page
- Check database for post record
Markdown not rendering
Problem: Post content shows raw Markdown
Solution:
- Ensure Markdown renderer is properly configured
- Check for syntax errors in Markdown
- Verify content field contains valid Markdown
- Test with simple Markdown first
Admin access denied
Problem: Can't access /admin/posts
Solution:
- Verify you're signed in as admin
- Check your email is in
ADMIN_EMAILS - Clear browser cache and retry
- Check admin layout permissions
Next Steps
- Admin System - Admin panel overview
- SEO - Search engine optimization
- Content Management - Advanced post management