GitHub Workflow for Blog Content
How to use the two-repository workflow for blogging
By Ali Alqattan
workflow github blogging automation
GitHub Workflow for Blog Content
This post demonstrates the powerful two-repository workflow for content management.
Workflow Overview
Repository Structure
- Blog Code Repository (
myblog
): Contains the Astro application - Content Repository (
blog-content
): Contains markdown posts
Writing Process
- Write posts in the content repository
- Push changes to trigger automatic rebuilds
- Blog automatically fetches and displays new content
Content Features
Frontmatter Support
---
title: "Your Post Title"
description: "Brief description"
date: 2025-01-15
tags: ["tag1", "tag2"]
draft: false
author: "Your Name"
---
Advanced Markdown
Bold text, italic text, and inline code
are supported.
Code Blocks with Syntax Highlighting
def fetch_github_content():
"""Fetch blog content from GitHub API."""
octokit = Octokit(auth=token)
response = octokit.rest.repos.getContent({
owner: 'your-username',
repo: 'blog-content',
path: 'posts'
})
return response.data
Lists and Organization
- ✅ Automatic content sync
- ✅ Build-time optimization
- ✅ Graceful error handling
- ✅ Local development support
Benefits
- Separation of Concerns: Code and content in separate repositories
- Collaboration: Easy for multiple authors to contribute
- Performance: Static generation with GitHub API fetching
- Reliability: Fallback to local content if GitHub is unavailable
This workflow provides the perfect balance of automation and control!