18 KiB
Blog System - Remaining Features TODO
Overview
This document consolidates all remaining blog system features that need to be implemented in siliconpin. The core blog functionality (listing, creation, editing, viewing) is complete and working. This document tracks the remaining engagement and interaction features.
Current Implementation Status
✅ Completed Features (85% Done)
Core Blog Functionality
- Blog Listing Page - Fully implemented with search, tags, pagination
- Blog Creation - Complete with BlockNote rich text editor, tags, image upload
- Blog Detail View - Working with SEO, related posts, view tracking
- Blog Editing - Full edit functionality with owner authorization
- Blog Deletion - Owner-only deletion with confirmation
- API Routes - All blog CRUD operations (GET, POST, PUT, DELETE)
- Database Model - Complete blog model with user ownership
- Authentication - Protected routes, owner-only operations
- Image Upload - MinIO integration for blog images
- Draft/Publish - Save drafts and publish when ready
- Search & Filter - Full-text search and tag-based filtering
- SEO Optimization - Metadata, OpenGraph, Twitter cards
- Analytics - View tracking and dashboard statistics
❌ Remaining Features (15% To Do)
Priority Order:
- Social Share (HIGH - Quick win, 30 min effort)
- Comment System (HIGH - Major engagement feature)
- Clapping System (MEDIUM - Unique engagement feature)
- Other Features (LOW - Nice to have)
1. Comment System Implementation
Overview
Full comment functionality allowing users to engage with blog posts through discussions, replies, and nested conversations.
Database Schema Required
Comments Collection
{
_id: ObjectId,
blogId: ObjectId, // Reference to Blog
blogSlug: String, // For easier queries
author: ObjectId, // Reference to User
content: String, // Comment text (HTML or Markdown)
parentComment: ObjectId, // For nested replies (null for top-level)
createdAt: Date,
updatedAt: Date,
editedAt: Date, // Track if comment was edited
votes: {
up: Number,
down: Number
},
status: String, // 'published', 'hidden', 'deleted'
depth: Number, // Nesting level (0 for top-level)
replies: [ObjectId] // Child comment references
}
API Routes to Implement
Comment APIs
-
GET /api/blogs/[slug]/comments
- Get all comments for a blog- Support pagination and sorting (newest, oldest, most liked)
- Include nested replies with depth limit
- Filter by status (show only published)
-
POST /api/blogs/[slug]/comments
- Add new comment (authenticated)- Validate content and blog existence
- Support reply to existing comment
- Auto-publish or moderation queue
-
PUT /api/comments/[id]
- Update comment (author only)- Track edit history
- Validate ownership
-
DELETE /api/comments/[id]
- Delete comment (author/admin)- Soft delete (mark as deleted, keep for thread continuity)
- Handle cascading for replies
-
POST /api/comments/[id]/vote
- Vote on comment- Prevent duplicate voting
- Update vote counts
Components to Create
Comment Components
-
components/blogs/comments/CommentSection.tsx
- Main container for all comments
- Handle loading states and error boundaries
- Sorting and filtering controls
-
components/blogs/comments/CommentsList.tsx
- Render list of comments with nesting
- Infinite scroll or pagination
- Optimistic updates
-
components/blogs/comments/CommentItem.tsx
- Individual comment display
- Show author, date, content
- Edit/delete actions for owner
- Reply button
-
components/blogs/comments/CommentForm.tsx
- Rich text or markdown editor
- Character limit and validation
- Preview mode
- Submit with authentication check
-
components/blogs/comments/CommentReply.tsx
- Inline reply form
- Nested display with indentation
- Collapse/expand thread functionality
-
components/blogs/comments/CommentVoting.tsx
- Upvote/downvote buttons
- Display vote counts
- Optimistic updates
Integration Points
- Add CommentSection to
/app/blogs/[slug]/page.tsx
- Update blog model to track comment count
- Add comment count to BlogCard component
- Show recent comments in dashboard
- Add comment moderation to admin panel (future)
Technical Requirements
- Implement real-time updates with polling or websockets
- Add rate limiting to prevent spam
- Implement proper XSS protection for comment content
- Add profanity filter (optional)
- Support markdown or rich text formatting
- Implement comment threading with max depth (e.g., 3 levels)
2. Clapping System Implementation (Medium-style)
Overview
Implement a Medium-style clapping system that allows users to show appreciation levels (1-50 claps per post) rather than simple binary likes. This creates deeper engagement and better content quality signals.
Current Status
NEW APPROACH - Switching from traditional likes to a more engaging clapping system inspired by Medium.
Database Updates Required
Blog Model Enhancement
// In models/blog.ts
claps: {
total: {
type: Number,
default: 0,
index: true // For efficient sorting by popularity
},
uniqueUsers: {
type: Number,
default: 0 // Count of unique users who clapped
},
userClaps: [{
userId: {
type: Schema.Types.ObjectId,
ref: 'User',
required: true
},
count: {
type: Number,
min: 1,
max: 50, // Maximum 50 claps per user per post
required: true
},
lastClappedAt: {
type: Date,
default: Date.now
}
}]
}
// Add compound index for efficient queries
BlogSchema.index({ 'claps.userId': 1, '_id': 1 })
BlogSchema.index({ 'claps.total': -1 }) // For sorting by popularity
API Endpoints to Implement
Clapping Endpoints
-
POST /api/blogs/[slug]/clap
- Add claps to a post// Request { "claps": 5 // Number of claps to add (1-50 total per user) } // Response { "success": true, "data": { "slug": "blog-slug", "totalClaps": 234, // Total claps on the post "userClaps": 10, // Current user's total claps "remainingClaps": 40, // How many more user can add "uniqueUsers": 45 // Number of people who clapped } }
-
GET /api/blogs/[slug]/clap-status
- Get current clap status- Return total claps and current user's clap count
- Check remaining claps available for user
- Used for initial page load
-
DELETE /api/blogs/[slug]/clap
- Remove all user's claps (optional)- Allow users to undo their claps
- Reset user's clap count to 0
Components to Create
Clapping Components
-
components/blogs/ClapButton.tsx
interface ClapButtonProps { blogSlug: string initialTotalClaps: number initialUserClaps?: number maxClaps?: number // Default 50 size?: 'sm' | 'md' | 'lg' showCount?: boolean className?: string }
- Interaction Modes:
- Click to add single clap
- Hold for continuous clapping (with acceleration)
- Show +1, +2, +3 floating animations
- Features:
- Optimistic updates with
useOptimistic
- Debounced API calls (wait for user to finish)
- Animated clap counter
- Haptic feedback on mobile (vibration)
- Progress indicator (10/50 claps used)
- Confetti animation at milestones (10, 25, 50)
- Optimistic updates with
- Interaction Modes:
-
components/blogs/ClapCounter.tsx
- Display total claps with formatting (1.2k, 1M)
- Show breakdown on hover (234 claps from 45 readers)
- Average claps per user indicator
- Trending badge for high engagement
-
components/blogs/ClapAnimation.tsx
- Floating +1 animations on each clap
- Hand clap icon animation
- Particle effects for multiple claps
- Smooth number transitions
Integration Points
- Add ClapButton to blog post pages (after content, near share buttons)
- Show clap counts in BlogCard components
- Update dashboard with total claps statistics
- Add "Most Appreciated" section to blog listing
- Sort blogs by engagement (claps/unique users ratio)
- Show user's clapping history in profile
UI/UX Design
// Visual representation
<div className="flex items-center gap-4">
{/* Clap button with animation */}
<button className="group relative">
<span className="text-2xl">👏</span>
{/* Floating +1 animation */}
{showAnimation && <span className="animate-float">+1</span>}
{/* Progress ring showing 10/50 */}
<svg className="absolute inset-0">
<circle strokeDasharray={`${progress} 100`} />
</svg>
</button>
{/* Clap counter */}
<div className="flex flex-col">
<span className="font-bold">234</span>
<span className="text-xs text-muted">
{userClaps > 0 && `You: ${userClaps}`}
</span>
</div>
</div>
Technical Specifications
- Rate Limiting: Max 50 claps per user per post
- Debouncing: Wait 1 second after last clap to send API request
- Batch Updates: Send total claps in one request, not individual
- Optimistic UI: Update immediately, rollback on error
- Cache Strategy: Cache clap counts in Redis for 5 minutes
- Analytics: Track clapping patterns and engagement metrics
- Performance: Use React.memo for clap animations
Mobile Enhancements
- Touch and hold for rapid clapping
- Haptic feedback (vibration) on each clap
- Larger touch target on mobile devices
- Swipe up gesture for quick 10 claps
- Native sharing integration after clapping
Engagement Features
- Milestones: Special animations at 10, 25, 50 claps
- Achievements: "Super Fan" badge for maxing out claps
- Notifications: Notify authors of high clap counts
- Leaderboard: Top clappers in user profiles
- Analytics: Clap heatmap showing when users clap most
Previous Issues & Solutions
Why Clapping over Likes:
- More engaging and fun interaction
- Shows content quality (50 claps from 1 user vs 1 clap from 50)
- Creates deeper connection with content
- Differentiates from generic social platforms
- Better analytics for content creators
3. Social Share Implementation (HIGH PRIORITY)
Overview
Add social sharing functionality to individual blog posts to increase content reach and engagement. The share buttons should be prominently placed for maximum visibility.
Current Status
- ShareButtons component exists at
/components/blogs/ShareButtons.tsx
but is NOT integrated - Component is already built with Twitter, LinkedIn, Facebook, and copy link functionality
Implementation Requirements
Placement & Design
- Location: Place share buttons immediately after the tags section on blog post pages
- Position: Near the end of the blog post (after content, before related posts)
- Layout: Horizontal row of share buttons with icons and labels
- Mobile: Stack vertically on small screens
- Styling: Match existing blog design system
Component Integration
- Add ShareButtons to
/app/blogs/[slug]/page.tsx
// After tags section, before related posts <div className="border-t pt-6 mt-8"> <h3 className="text-lg font-semibold mb-4">Share this article</h3> <ShareButtons url={`${baseUrl}/blogs/${blog.slug}`} title={blog.title} description={blog.excerpt} /> </div>
Features to Implement
-
Share Options:
- Twitter/X (with hashtags from blog tags)
- LinkedIn (professional audience)
- Facebook (general audience)
- WhatsApp (mobile sharing)
- Copy link (with toast notification)
- Email (mailto link with subject/body)
-
Enhanced Functionality:
- Add share count tracking in database
- Show share counts next to buttons (optional)
- Analytics event tracking for shares
- Custom share messages per platform
- Include author Twitter handle if available
API Endpoints (Optional)
POST /api/blogs/[slug]/share
- Track share events{ "platform": "twitter" | "linkedin" | "facebook" | "whatsapp" | "email" | "copy", "timestamp": "2025-08-10T..." }
Social Meta Tags Enhancement
-
Verify Open Graph tags are properly set:
og:title
- Blog titleog:description
- Blog excerptog:image
- Blog cover imageog:url
- Full blog URLog:type
- "article"
-
Add Twitter Card tags:
twitter:card
- "summary_large_image"twitter:title
- Blog titletwitter:description
- Blog excerpttwitter:image
- Blog cover imagetwitter:creator
- Author's Twitter handle
Mobile Optimization
- Add native share API for mobile devices
if (navigator.share) { await navigator.share({ title: blog.title, text: blog.excerpt, url: blogUrl, }) }
Analytics Integration
- Track share button clicks
- Monitor which platforms get most shares
- A/B test button placement and design
- Track conversion from shares to visits
Technical Implementation
// Example integration in blog post page
<article>
{/* Blog content */}
<div dangerouslySetInnerHTML={{ __html: blog.content }} />
{/* Tags section */}
<div className="flex flex-wrap gap-2 mt-8">
{blog.tags.map(tag => (
<Link key={tag} href={`/blogs?tag=${tag}`}>
<Badge>{tag}</Badge>
</Link>
))}
</div>
{/* NEW: Social Share Section */}
<div className="border-t border-b py-6 my-8">
<div className="flex items-center justify-between flex-wrap gap-4">
<h3 className="text-lg font-semibold">Share this article</h3>
<ShareButtons
url={fullBlogUrl}
title={blog.title}
description={blog.excerpt}
tags={blog.tags}
author={blog.author}
/>
</div>
</div>
{/* Related posts section */}
<RelatedPosts />
</article>
Success Criteria
- Share buttons visible on all blog posts
- All share platforms working correctly
- Mobile-responsive design
- Share tracking implemented
- No impact on page load performance
- Proper social media previews when shared
Priority
HIGH - This is a quick win that can significantly increase blog reach and engagement with minimal implementation effort since the component already exists.
Estimated Effort
30 minutes - 1 hour - Component exists, just needs integration and styling adjustments.
4. User Engagement Features
Bookmarking System
- Allow users to bookmark blogs for later reading
- Create "My Bookmarks" section in user profile
- Add bookmark count to blog statistics
Follow System
- Follow specific authors
- Get notifications for new posts (future)
- "Following" feed on dashboard
Blog Recommendations
- Improve related posts algorithm
- Add "You might also like" section
- Personalized recommendations based on reading history
4. Advanced Features (Future)
Moderation Tools
- Report inappropriate content
- Admin moderation panel
- Auto-moderation with content filters
- User reputation system
Analytics Enhancement
- Reading time tracking (actual vs estimated)
- Scroll depth analytics
- User engagement metrics
- Popular content insights
Performance Optimization
- Implement comment pagination
- Add Redis caching for hot content
- Optimize database queries
- Implement CDN for images
Implementation Priority
Phase 1: Core Engagement (1-2 sessions)
- Like System - Essential for user engagement
- Basic Comments - Top-level comments only
Phase 2: Advanced Interaction (1-2 sessions)
- Nested Comments - Reply functionality
- Comment Voting - Upvote/downvote comments
- Social Sharing - Integration with existing component
Phase 3: Enhancement (1 session)
- Bookmarking - Save for later functionality
- Follow System - Author following
- Moderation - Basic reporting system
Success Criteria
Minimum Viable Engagement
- Users can like/unlike blog posts
- Users can comment on blog posts
- Comments display with proper formatting
- Like counts persist correctly
- No performance degradation
Full Implementation
- Nested comment threads working
- Voting on comments functional
- Social sharing integrated
- Analytics tracking all interactions
- Mobile-responsive for all features
Technical Considerations
Database
- Ensure proper indexes for performance
- Implement soft deletes for data integrity
- Use transactions for vote/like operations
- Regular backup strategy
Security
- Rate limiting on all interaction endpoints
- XSS protection for user content
- CSRF protection for state-changing operations
- Input validation and sanitization
Performance
- Implement caching strategy
- Optimize database queries
- Lazy load comments
- Debounce like/vote actions
User Experience
- Optimistic updates for all interactions
- Clear error messages
- Loading states
- Mobile-first design
- Accessibility compliance
Dependencies
Required Systems
- ✅ MongoDB (already configured)
- ✅ Authentication system (working)
- ✅ Blog system (core complete)
- ⚠️ Redis cache (configured but verify)
Technical Stack
- ✅ Next.js 15 App Router
- ✅ TypeScript
- ✅ Mongoose ODM
- ✅ TanStack Query
- ✅ React Hook Form
Notes
- The blog system core is production-ready
- These remaining features focus on user engagement
- Comment system is the highest priority missing feature
- Like system was previously attempted but needs fresh implementation
- All features should maintain the existing design system
Created: 2025-08-10
Last Updated: 2025-08-10
Status: Planning Complete - Ready for Implementation
Overall Blog System Completion: 85%
Remaining Work: Comment System (10%) + Like System (5%)