Get up and running in 5 minutes
# Clone the repository
git clone https://github.com/your-org/blog-engine.git
cd blog-engine
# Install dependencies
npm install
# Set up environment (optional - only for AI features)
cp .env.example .env
# Edit .env with your configuration
# Start development server
npm run devOpen http://localhost:8080/blog
touch src/content/blog/2024-01-15-my-first-post.md---
title: "My First Blog Post"
excerpt: "This is my first post using the AI Blog Engine"
author: "Your Name"
date: "2024-01-15"
category: "Tutorial"
readTime: "3 min read"
image: /images/blog/2024-01-15-my-first-post.webp
---
# My First Blog Post
Welcome to my blog! This is so easy to use.
## Features I Love
- Simple markdown syntax
- Automatic SEO optimization
- Beautiful responsive design
- AI-powered images (optional)
## Code Example
```javascript
console.log("Hello, World!");Start writing your content here!
### 3. Add an Image (Two Options)
#### Option A: Manual Image
1. Add your image to `public/images/blog/`
2. Reference it in the frontmatter: `image: /images/blog/your-image.webp`
#### Option B: AI-Generated Image
```bash
npm run generate:blog-image src/content/blog/2024-01-15-my-first-post.md
Requires OpenAI and Gemini API keys in .env
---
title: string # Post title (required)
excerpt: string # Short description (required)
author: string # Author name (required)
date: string # ISO date YYYY-MM-DD (required)
category: string # Category tag (required)
readTime: string # e.g., "5 min read" (required)
image: string # Path to image (required)
---# Generate SEO files (sitemap, robots.txt)
npm run seo:gen
# Build for production
npm run build
# Preview production build
npm run previewDeploy the dist/ folder to any static host (Netlify, Vercel, GitHub Pages, etc.)
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run preview |
Preview production build |
npm run seo:gen |
Generate sitemap & robots.txt |
npm run optimize:blog |
Convert PNG to WebP |
npm run generate:blog-image <file> |
AI-generate post image |
Edit src/seo/config.ts:
export const siteUrl = 'https://yourdomain.com';
export const siteName = 'Your Blog Name';
export const defaultTitle = 'Your Blog - Tagline';
export const defaultDescription = 'Your blog description';
export const twitterHandle = '@yourhandle';Create .env:
# Site Configuration
VITE_SITE_URL=https://yourdomain.com
VITE_SITE_NAME=My Blog
# AI Features (Optional)
OPENAI_API_KEY=sk-...
GEMINI_API_KEY=...Edit tailwind.config.js:
module.exports = {
theme: {
extend: {
colors: {
primary: '#your-brand-color',
}
}
}
};blog-engine/
├── src/
│ ├── content/blog/ # 📝 Your blog posts (*.md)
│ ├── pages/
│ │ ├── Blog.tsx # Blog listing page
│ │ └── BlogPost.tsx # Individual post renderer
│ ├── utils/
│ │ └── blogUtils.ts # Markdown parser
│ └── seo/
│ ├── SEO.tsx # SEO component
│ ├── config.ts # 🔧 Configure here
│ └── schema.ts # Schema.org helpers
│
├── public/
│ └── images/blog/ # 🖼️ Add images here
│
└── scripts/
├── generate-blog-image.js # AI image generation
├── optimize-blog-images.js # Image optimization
└── generate-seo.mjs # SEO generation
Just use it in your frontmatter - categories are automatic:
category: "New Category Name"Edit src/App.tsx:
// Change from /blog/:slug to /posts/:slug
<Route path="/posts/:slug" element={<BlogPost />} />Edit src/pages/BlogPost.tsx to change:
- Typography styles
- Layout structure
- Color schemes
- Animation effects
- Create
src/pages/Author.tsx - Filter posts by author in
getBlogPosts() - Add route:
<Route path="/author/:name" element={<Author />} />
- Check file is in
src/content/blog/with.mdextension - Verify frontmatter is valid YAML between
---markers - Check console for parsing errors
- Ensure date is in
YYYY-MM-DDformat
- Verify image path starts with
/images/blog/ - Check file exists in
public/images/blog/ - Clear cache and reload: Cmd/Ctrl + Shift + R
# Clear cache and rebuild
rm -rf node_modules dist
npm install
npm run build- Ensure code blocks specify language:
```javascript - Check
react-syntax-highlighteris installed - Verify
remarkGfmplugin is imported
Create .template files as starting points:
cp src/content/blog/blog-post.template src/content/blog/2024-01-15-new-post.md# Place PNG images in public/images/blog/
npm run optimize:blog
# Auto-converts all to WebPAdd to package.json:
{
"scripts": {
"prebuild": "npm run seo:gen && npm run optimize:blog"
}
}Now SEO files generate automatically before each build!
The dev server watches for markdown changes - just save and refresh!
Prefix with underscore to hide:
src/content/blog/_draft-post.mdUpdate blogUtils.ts to filter:
.filter(([path]) => !path.includes('/_'))- Read Full Documentation: See
README.mdfor comprehensive guide - Customize Styling: Update
tailwind.config.jsand components - Add Features: RSS feed, search, categories, tags
- Deploy: Push to Netlify, Vercel, or your preferred host
- Share: Link to your open source blog engine in posts
- Documentation: Read the full README.md
- Issues: Check GitHub Issues
- Examples: Study the
.templatefiles - Community: Ask questions in Discussions
Start creating amazing content with your AI-assisted blog engine!
# Create a post
touch src/content/blog/$(date +%Y-%m-%d)-my-awesome-post.md
# Generate an image
npm run generate:blog-image src/content/blog/$(date +%Y-%m-%d)-my-awesome-post.md
# Build and deploy
npm run buildHappy blogging! 🚀
Last Updated: October 2024