
blog-management
Manage blog posts including creating, editing, viewing, and troubleshooting blog-related features. U
Blog Management
Overview
This skill helps you work with blog post management features in the admin_side application. It includes creating new posts, editing existing posts, managing tags, handling thumbnails, and working with the Quill rich text editor.
Key Files and Components
Blog Pages
src/app/admin/blogs/page.tsx- Blog listing pagesrc/app/admin/blogs/create/page.tsx- Create new blog pagesrc/app/admin/blogs/edit/page.tsx- Edit existing blog pagesrc/app/admin/blogs/blog-form.tsx- Main blog form component
Related Components
src/app/admin/components/inputs/rich-text-editor/- Quill editor componentssrc/app/admin/components/inputs/multi-chip-input.tsx- Tag input componentsrc/app/admin/components/inputs/thumbnail-input.tsx- Image upload component
Domain Models
src/domains/post.ts- Blog post model and typessrc/domains/tag.ts- Tag model and types
Common Tasks
Working with Blog Posts
When creating or editing blog posts:
-
Read the blog form to understand the current structure:
Read src/app/admin/blogs/blog-form.tsx -
Check the post domain model for data structure:
Read src/domains/post.ts -
Review API integration in
src/config/api.config.ts
Blog Post Fields
A blog post typically includes:
- title: Post title
- previewContent: Short preview/excerpt
- content: Full HTML content from Quill editor
- thumbnailPaths: Array of image URLs
- published: Boolean status (draft/published)
- postTags: Array of tags with name and color
- categoryId: Selected category ID
- rowVersion: For optimistic locking
Rich Text Editor
The project uses Quill 2.0 with plugins:
- quill-html-edit-button
- quill-resize-image
- quill-table-better
- quill-toggle-fullscreen-button
- highlight.js for code syntax
When working with the editor:
- Check
RichTextEditorWrappercomponent for setup - Verify plugin initialization
- Test content saving and loading
Tag Management
Tags use the MultiChipInput component with:
- Random color assignment
- Add/remove functionality
- Label-based storage
Thumbnail Management
Images are handled by ThumbnailsInput:
- Accepts image uploads
- Returns array of paths
- Displays preview thumbnails
API Endpoints
Blog posts use REST API endpoints:
GET /posts- List all postsGET /posts/:id- Get single postPOST /posts- Create new postPUT /posts/:id- Update existing postDELETE /posts/:id- Delete post
All endpoints require Bearer token authentication via authenticatedFetch.
Best Practices
- Always validate data before submission
- Handle loading states with appropriate UI feedback
- Preserve rowVersion for optimistic locking on updates
- Test rich text content for proper HTML rendering
- Check authentication before API calls
- Handle errors gracefully with user-friendly messages
- Use TypeScript types from domain models
Debugging Tips
If you encounter issues:
- Check browser console for API errors
- Verify authentication token is valid
- Check network tab for failed requests
- Validate form data matches API expectations
- Test Quill editor initialization
- Verify image upload paths are correct
Example Workflow
When implementing a new blog feature:
- Read relevant domain model
- Review existing blog-form.tsx implementation
- Check API configuration
- Test with existing data
- Implement changes following established patterns
- Validate with TypeScript
- Test in development server