ZAGC is your static site's best companion:
- π Blazing-fast builds with Zola
- π€ Smooth automation via GitHub Actions
- π§ Flexible headless content management with Cockpit CMS
Build fast, update easily, and deploy β¨
π§ͺ Note: ZAGC is in an early testing phase. Itβs under development and currently being trialed in real-world scenarios.
ZAGC is a lightweight and flexible template stack designed for building and managing static websites. It integrates multiple tools to automate everything from content management to build and deployment:
- Zola β A Rust-based static site generator
- Cockpit CMS β A headless CMS
- GitHub Actions β For automated builds and deployments
- Fetch content and assets from Cockpit
- Convert to Markdown (compatible with Zola)
- Convert and resize uploaded images to
.webp
- Build the static site using Zola
- Upload to the public server
- Archive the current website on GitHub (for version history)
ZAGC is intended as a practical alternative for users facing challenges with traditional dynamic CMS systems.
Examples of systems you can migrate from:
- Headless CMS that provide content via REST API
- Cloud services allowing posting and image upload via admin UI
- Traditional CMS using themes and templates for visual design
ZAGC focuses on the following to ensure smooth and natural operation post-migration:
- Converts standard structures like posts, pages, tags, and categories into Zola-compatible Markdown
- Supports flexible schema designs including custom fields
- Downloads images along with content and converts them to
.webp
by use case - Automatically generates thumbnails, medium, and large sizes
- Removes original images to reduce storage footprint
- Automates build and publish via GitHub Actions
- Enables fast updates and minimizes deployment errors
- Reduces infrastructure dependency so you can focus on content
With this setup, you can break free from the limitations and performance concerns of dynamic CMSs, and run a website focused on maintainability, speed, and freedom.
github-project-repo/
βββ .env.example.php # Example environment configuration file (template for env vars)
βββ .env.php # Actual environment configuration file (should be gitignored)
βββ .gitignore # Files and directories ignored by Git
βββ .gitattributes # Git settings for handling files (e.g., line endings)
βββ .github/
β βββ workflows/
β βββ build.yml # GitHub Actions workflow definition for CI/CD
βββ .bin/
β βββ zola # Fixed version of the Zola binary (static site generator)
βββ cockpit/ # API extensions or custom modules for Cockpit CMS
βββ scripts/ # Go / Shell scripts for content and build management
β βββ image_process.go # Image conversion and resizing (.webp, thumbnails, etc.)
β βββ convert_to_md.go # Convert Cockpit JSON to Markdown and clean up missing content
β βββ fetch_assets.go # Download new assets from Cockpit and remove deleted ones
β βββ load_env_php.sh # Parse PHP-style config (define('KEY','VAL')) and export as env vars
β βββ run_build.sh # Fetch data, convert content, build Zola site, and deploy via FTP
βββ data/ # Temporary JSON files fetched from Cockpit API
β βββ items.json
βββ tmp/ # Temporary files (e.g., Zola installation workspace)
βββ zola/
β βββ shortcodes/ # Zola shortcodes (reusable mini-templates)
β βββ content/ # Markdown content (converted from Cockpit)
β β βββ blog/
β β βββ info/
β βββ templates/ # Zola HTML templates
β β βββ partials/ # Template fragments (e.g., header, footer)
β βββ sass/ # SCSS (Sass) files for styling
β βββ static/ # Static assets served as-is (not processed by Zola)
β β βββ api/ # REST API endpoints or related scripts
β β βββ img/ # Images used in the site
β β βββ js/ # JavaScript files
β β βββ uploads/ # Uploaded files from CMS or elsewhere
β βββ themes/ # (Optional) Zola themes (if used)
β βββ config.toml # Zola configuration file (site settings, language, base URL, etc.)
β βββ Cargo.toml # Rust project config (for custom shortcodes if any)
β βββ public/ # Static site output generated by `zola build`
βββ history/ # Archive directory for build outputs (committed to build-history branch)
βββ README.md # Project overview and usage instructions
βββ LICENSE
# Cockpit CMS
COCKPIT_URL=http://localhost/cockpit
COCKPIT_TOKEN=xxxxxxxx
COCKPIT_SPACE=your-space-name (optional)
COCKPIT_ITEMS_API_PATH=api/content/items
COCKPIT_ITEMS=info,blog
COCKPIT_ASSETS_API_PATH=api/public/getAssets
# If deploying to a website that includes a path, be sure to include the path as well, e.g., https://example.com/path
DEPLOY_URL=/
# FTP upload settings (optional)
FTP_HOST=ftp.example.com
FTP_PORT=21
FTP_HOST_PATH=/
FTP_USER=username
FTP_PASSWORD=password
FTP_REMOTE_DIR=/htdocs/
Go to https://github.com and log in to your account.
- Click on your profile icon at the top right corner and select
Settings
. - In the left sidebar, select
Developer settings
βPersonal access tokens
βTokens (classic)
. - Click on "Generate new token (classic)".
- Note: Provide a label or note for the token (e.g.,
Deploy Trigger Token
). - Expiration: Set an expiration date (recommended:
90 days
orNo expiration
). - Scopes (permissions): Check at least the following scopes:
- β
repo
(to access your repository) - β
workflow
(to manage GitHub Actions workflows)
- β
The token will only be displayed once. Make sure to copy it and store it securely.
Add the following to your .env.php
file.
- Fixed version of Zola to avoid future compatibility issues
.bin/
andzola/public/
are excluded from Git version control via.gitignore
- Efficient syncing: delta downloads and asset cleanup from Cockpit to minimize traffic
- Go scripts use direct CLI tool calls (e.g. ImageMagick) without Go modules
- GitHub Actions installs required tools like
imagemagick
andwebp
using:
- name: Install ImageMagick and WebP tools
run: sudo apt-get update && sudo apt-get install -y imagemagick webp
- Better error handling and logging
- Generalization of templates and configuration
- Further optimization for migration scenarios
- Categories: Organize and group your content with category support.
- Breadcrumbs: Easily navigate your siteβs hierarchy with breadcrumbs.
- Code Highlighting: Syntax highlighting for code blocks for better readability.
- Prev/Next Links: Seamlessly move to the previous or next post in the section.
- Sidebar: A handy sidebar for additional navigation or widgets.
- Hamburger Menu: A responsive hamburger menu for mobile-friendly navigation.
- Contact Send Mail: Contact form functionality to send inquiries via email.
- Pagination: Implemented based on this pagination gist
MIT License
- Zola β Static Site Generator
- Cockpit CMS β Headless CMS
- GitHub Actions β CI/CD automation