Transform your GitHub Gists into a beautiful, fast blog powered by Cloudflare Workers.
This blog system displays only public gists. For best practices, use a GitHub token with minimal permissions and consider using a dedicated GitHub account for blog content.
- π GitHub Gists as Posts - Write in Gist, publish instantly
- π·οΈ Tag System - Organize posts with
#hashtags
in descriptions - π Dark Mode - Automatic theme switching based on system preference
- β‘ Lightning Fast - Powered by Cloudflare Workers edge network
- π SEO Optimized - Meta tags, sitemap.xml, RSS feed included
- π± Mobile Responsive - Beautiful on all devices
- ποΈ Smart Caching - KV storage for optimal performance
- π¦ Local Management - Powerful Go CLI tools for gist operations
- GitHub account with personal access token
- Cloudflare account (free tier works)
- Go 1.19+ (for CLI tools)
- Node.js 16+ (for deployment)
git clone https://github.com/yourusername/gist-blog.git
cd gist-blog
# Install dependencies
npm install
# Set environment variables
export GITHUB_USER="your-github-username"
export GITHUB_TOKEN="ghp_your_token_here"
# Login to Cloudflare
wrangler login
# Set required secrets
wrangler secret put GITHUB_USER
# Enter: your-github-username
wrangler secret put GITHUB_TOKEN
# Enter: ghp_your_token_here
wrangler secret put SITE_URL
# Enter: https://your-domain.com
wrangler secret put SITE_NAME
# Enter: Your Blog Name
# Deploy to Cloudflare
wrangler deploy
# Initialize gist CLI
gist init
# Write a post
echo "# My First Post\n\nHello from Gist Blog!" > post.md
# Stage and upload
gist add -p -d "My First Blog Post #introduction #hello" post.md
gist push
Visit your blog at https://your-domain.com
π
Create posts as GitHub Gists with markdown files:
# Your Post Title
Write your content in **Markdown** with full support for:
- Lists
- Code blocks
- Images
- Links
- And more!
Use familiar git-like commands:
# Pull latest gists from GitHub
gist pull
# Check status
gist status
# Stage new posts
gist add -p -d "Post Title #tag1 #tag2" post.md
# Stage multiple files
gist add file1.md file2.md -d "Multi-file post #code"
# Add tags to existing gist
gist tag <gist-id> featured tutorial
# Remove a gist
gist rm <gist-id>
# Push all changes
gist push
# Search gists
gist search "docker"
# Show gist details
gist show <gist-id>
# View recent posts
gist log
make help # Show all commands
make dev # Local development
make deploy # Deploy to production
make build # Build gist CLI
make install-cli # Install gist command
make pull # Pull latest from GitHub
make status # Show staged changes
make list # List all posts
make search Q=term # Search posts
βββ Worker (Edge)
β βββ Routing # /, /gist/:id, /tag/:tag, /rss.xml
β βββ GitHub API # Fetch gists with caching
β βββ Markdown Parser # Built-in markdown rendering
β βββ KV Cache # 5-minute TTL for performance
β
βββ CLI Tools (Local)
β βββ gist # Git-style unified CLI
β βββ upload-gist # Legacy upload tool
β βββ gist-manager # Legacy management tool
β
βββ Features
βββ RSS Feed # /rss.xml for readers
βββ Sitemap # /sitemap.xml for SEO
βββ Meta Tags # Open Graph & Twitter cards
βββ Pagination # 10 posts per page
name = "your-blog"
main = "worker.js"
compatibility_date = "2024-01-01"
# Optional: KV namespace for caching
[[kv_namespaces]]
binding = "GIST_CACHE"
id = "your-kv-id"
# For custom domain
[[routes]]
pattern = "yourdomain.com/*"
zone_name = "yourdomain.com"
Note: Secrets (GITHUB_USER, GITHUB_TOKEN, SITE_URL, SITE_NAME) are configured via wrangler secret
commands, not in wrangler.toml.
Variable | Description | Required |
---|---|---|
GITHUB_USER |
Your GitHub username | β |
GITHUB_TOKEN |
Personal access token | β |
SITE_URL |
Your blog URL (e.g., https://blog.example.com) | β |
SITE_NAME |
Your blog name | β |
GIST_CACHE |
KV namespace binding | β (recommended) |
Add hashtags to gist descriptions for automatic categorization:
"My Docker Tutorial #docker #devops #tutorial"
Tags become clickable links: /tag/docker
Available at /rss.xml
for feed readers. Includes:
- Latest 20 posts
- Full metadata
- Category tags
- Semantic HTML5 structure
- Meta descriptions from post excerpts
- Open Graph tags for social sharing
- Automatic sitemap generation
- Canonical URLs
- Edge deployment (< 50ms latency worldwide)
- KV caching reduces GitHub API calls
- Optimized asset delivery
- Minimal JavaScript (none by default)
- Add domain to Cloudflare
- Update
wrangler.toml
:[[routes]] pattern = "blog.yourdomain.com/*" zone_name = "yourdomain.com"
- Deploy:
wrangler deploy
The GitHub token secret you configured during deployment allows access to private gists. No additional configuration needed.
# Export all gists
gist pull
cat .gist-cache/gists.json | jq
# Batch tag updates
for id in $(gist list | grep -o '^[a-f0-9]\{7\}'); do
gist tag "$id" "archived"
done
gist push
# Clean up old posts
gist search "temp" | grep -o '^[a-f0-9]\{7\}' | \
xargs -I {} gist rm {}
gist push
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT License - see LICENSE file for details.
- Built with Cloudflare Workers
- Inspired by static site generators
- Powered by GitHub's Gist API
Transform your GitHub gists into a beautiful blog in minutes, not hours.