gitblog1
This commit is contained in:
4
sample-content/navigation.md
Normal file
4
sample-content/navigation.md
Normal file
@@ -0,0 +1,4 @@
|
||||
Home|/
|
||||
About|/page/about
|
||||
Posts|/|1
|
||||
Contact|/page/contact
|
50
sample-content/pages/about.md
Normal file
50
sample-content/pages/about.md
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
title: "About"
|
||||
---
|
||||
|
||||
# About GitBlog
|
||||
|
||||
GitBlog is a modern, responsive blog system built with Go that uses GitHub as a headless CMS. It's designed for developers who want a simple, powerful way to manage their blog content.
|
||||
|
||||
## Philosophy
|
||||
|
||||
We believe that content management should be:
|
||||
|
||||
- **Simple**: Write in Markdown, store in GitHub
|
||||
- **Fast**: Optimized for performance and speed
|
||||
- **Flexible**: Customizable themes and layouts
|
||||
- **Reliable**: Built on proven technologies
|
||||
|
||||
## Technology Stack
|
||||
|
||||
- **Backend**: Go with Gorilla Mux for routing
|
||||
- **Frontend**: Vanilla HTML, CSS, and JavaScript
|
||||
- **Content**: Markdown with GitHub API
|
||||
- **Caching**: In-memory caching for performance
|
||||
- **Templating**: Go's built-in template engine
|
||||
|
||||
## Features
|
||||
|
||||
- Dynamic content loading from GitHub
|
||||
- Responsive design that works on all devices
|
||||
- Dark and light mode support
|
||||
- Automatic content updates
|
||||
- RSS feed generation
|
||||
- SEO-friendly URLs
|
||||
- Fast page loads with caching
|
||||
|
||||
## Getting Started
|
||||
|
||||
Ready to start your own blog? Check out our [Quick Start Guide](/post/welcome-to-gitblog) to get up and running in minutes.
|
||||
|
||||
## Contributing
|
||||
|
||||
GitBlog is open source and welcomes contributions! Whether you're fixing bugs, adding features, or improving documentation, we'd love your help.
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
||||
|
||||
---
|
||||
|
||||
*Built with ❤️ using Go and GitHub*
|
76
sample-content/posts/building-a-blog-with-go.md
Normal file
76
sample-content/posts/building-a-blog-with-go.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
title: "Building a Blog with Go and GitHub"
|
||||
date: 2024-01-20
|
||||
categories: ["Technology", "Go"]
|
||||
tags: ["golang", "web-development", "github-api", "tutorial"]
|
||||
---
|
||||
|
||||
# Building a Modern Blog with Go and GitHub
|
||||
|
||||
In this post, we'll explore how to build a modern blog system using Go and GitHub as a headless CMS.
|
||||
|
||||
## Why Go for Web Development?
|
||||
|
||||
Go is an excellent choice for web development because of:
|
||||
|
||||
- **Performance**: Fast compilation and execution
|
||||
- **Concurrency**: Built-in goroutines for handling multiple requests
|
||||
- **Simplicity**: Clean, readable code
|
||||
- **Standard Library**: Rich standard library for web development
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
Our blog system consists of several key components:
|
||||
|
||||
1. **GitHub API Client**: Fetches content from GitHub
|
||||
2. **Content Manager**: Parses Markdown and manages content
|
||||
3. **Cache Manager**: Provides performance optimization
|
||||
4. **Template Engine**: Renders HTML from templates
|
||||
5. **HTTP Server**: Handles requests and routing
|
||||
|
||||
## Key Features
|
||||
|
||||
### Dynamic Content Loading
|
||||
|
||||
The system automatically fetches content from GitHub and caches it for performance:
|
||||
|
||||
```go
|
||||
func (m *Manager) LoadContent() error {
|
||||
if err := m.loadPosts(); err != nil {
|
||||
return fmt.Errorf("failed to load posts: %w", err)
|
||||
}
|
||||
// ... load other content types
|
||||
return nil
|
||||
}
|
||||
```
|
||||
|
||||
### Responsive Design
|
||||
|
||||
The frontend is built with modern CSS and JavaScript:
|
||||
|
||||
- CSS Grid and Flexbox for layouts
|
||||
- CSS Custom Properties for theming
|
||||
- Responsive design principles
|
||||
- Dark/light mode support
|
||||
|
||||
### Performance Optimization
|
||||
|
||||
- In-memory caching reduces API calls
|
||||
- Lazy loading for images
|
||||
- Minified CSS and JavaScript
|
||||
- Efficient template rendering
|
||||
|
||||
## Getting Started
|
||||
|
||||
To get started with your own GitBlog instance:
|
||||
|
||||
1. Fork the repository
|
||||
2. Set up your GitHub token
|
||||
3. Configure your content structure
|
||||
4. Deploy to your preferred platform
|
||||
|
||||
## Conclusion
|
||||
|
||||
Building a blog with Go and GitHub provides a powerful, flexible solution for content management. The combination of Go's performance and GitHub's content storage creates a robust platform for modern blogging.
|
||||
|
||||
Happy coding! 🚀
|
49
sample-content/posts/welcome-to-gitblog.md
Normal file
49
sample-content/posts/welcome-to-gitblog.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
title: "Welcome to GitBlog"
|
||||
date: 2024-01-15
|
||||
categories: ["Technology", "Blogging"]
|
||||
tags: ["golang", "github", "blog", "cms"]
|
||||
---
|
||||
|
||||
# Welcome to GitBlog!
|
||||
|
||||
This is your first blog post using GitBlog, a modern blog system that uses GitHub as a headless CMS.
|
||||
|
||||
## What makes GitBlog special?
|
||||
|
||||
- **GitHub as CMS**: All your content lives in a GitHub repository
|
||||
- **Markdown Support**: Write posts in Markdown with full syntax support
|
||||
- **Responsive Design**: Beautiful, mobile-first design
|
||||
- **Dark/Light Mode**: Toggle between themes
|
||||
- **Auto-Updates**: Content updates automatically when you push to GitHub
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Create a new Markdown file in your `content/posts/` directory
|
||||
2. Add frontmatter with metadata
|
||||
3. Write your content in Markdown
|
||||
4. Push to GitHub
|
||||
5. Your blog updates automatically!
|
||||
|
||||
## Code Example
|
||||
|
||||
Here's a simple Go code example:
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, GitBlog!")
|
||||
}
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- **Categories**: Organize your posts by topic
|
||||
- **Tags**: Add tags for better discoverability
|
||||
- **Excerpts**: Automatic excerpt generation
|
||||
- **RSS Feed**: Built-in RSS feed at `/rss.xml`
|
||||
|
||||
Happy blogging! 🎉
|
Reference in New Issue
Block a user