automate a clean Jekyll repo structure from the start
Why automate the initial structure of a Jekyll project?
When building multiple Jekyll sites—whether for clients, documentation, blogs, or internal tools—it becomes inefficient to manually replicate best practices each time. Errors creep in, folders are misnamed, critical includes get forgotten, and inconsistent layouts affect maintainability.
Automation ensures every project starts with the same clean foundation. It also simplifies onboarding for teams by providing a predictable starting point.
What does a clean Jekyll starter structure include?
A solid starter structure contains:
- Minimal but complete folder hierarchy
- Pre-configured layouts and includes
- Common data files (authors, metadata)
- Placeholder content to test build
- Editable configuration layers
/
├── _config.yml
├── _data/
│ ├── authors.yml
│ └── nav.yml
├── _layouts/
│ ├── base.html
│ ├── post.html
│ └── page.html
├── _includes/
│ ├── head.html
│ ├── header.html
│ └── footer.html
├── _posts/
│ └── 2025-01-01-welcome.md
├── pages/
│ └── about.md
├── assets/
│ ├── css/
│ └── js/
├── .gitignore
├── Gemfile
└── README.md
How can you automate this structure creation?
There are several methods to automate the setup of a Jekyll repository:
1. Use a custom bash or Node.js CLI script
Create a CLI tool that copies predefined folder templates into a new project directory. Example bash script:
#!/bin/bash
echo "Creating Jekyll project: $1"
mkdir "$1"
cd "$1"
mkdir _layouts _includes _posts _data pages assets assets/css assets/js
touch _config.yml Gemfile README.md
echo "---" > _posts/$(date +%Y-%m-%d)-welcome.md
You can enhance it to copy starter layout files, insert license headers, or configure Git remotes automatically.
2. Use GitHub repository templates
Create a master repository with your preferred structure, then mark it as a template repository on GitHub. Whenever you need a new project, click “Use this template” to generate a fresh copy.
This preserves history-less cloning and allows new users to instantly get the best structure—no setup required.
3. Use Jekyll scaffolding tools
While Jekyll's jekyll new command creates a basic scaffold, it’s often too minimal for real-world projects. Instead, create your own starter CLI like jekyll-starter-cli using Ruby or Node.js that wraps:
- Repository cloning
- Dependency installation
- Git initialization and branching
- Environment configuration
4. Use GitHub Actions to validate structure on push
To enforce your structure, include a GitHub Action that checks if all required folders and files exist:
name: Validate Jekyll Structure
on: [push]
jobs:
check-structure:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check for essential directories
run: |
test -d _layouts || exit 1
test -d _includes || exit 1
test -f _config.yml || exit 1
What should be included in your starter repo?
To cover the needs of most projects, include:
- Standard layouts:
base.html,post.html,page.html - Reusable includes:
head.html,footer.html,language-switcher.html - Empty
_posts/folder with a sample post _data/authors.ymland_data/nav.yml- Basic Sass and JavaScript under
assets/ README.mdwith usage instructions
How do you make this automation reusable across teams?
You can publish your starter in three formats:
- As a public GitHub template repo
- As a private npm package or gem that sets up a project
- As a downloadable zip used with internal CLI tools
Add clear versioning and changelogs to communicate updates. Encourage team members to always begin from the official starter to maintain consistency.
Can you automate content scaffolding too?
Yes. Use script prompts to generate content templates:
bash new-post.sh
Script output:
Enter title: "How to Automate Jekyll Structure"
Creating file: _posts/2025-07-05-how-to-automate-jekyll-structure.md
Resulting file:
---
title: "How to Automate Jekyll Structure"
date: 2025-07-05
layout: post
author: admin
tags: [jekyll,automation]
---
This guarantees naming consistency, date formatting, and front matter correctness.
What naming conventions should be enforced?
Automation also helps enforce naming conventions for:
- File names: kebab-case for posts and pages
- Folders: lowercase only, no spaces
- Permalinks: standardized via front matter
Use linting or custom Git hooks to catch violations before commit.
How does automation contribute to clean repo growth?
With a well-automated setup:
- New projects follow best practices by default
- Teams spend less time on boilerplate and more on content
- Structure is enforced automatically, not just by policy
- Project scaling (e.g. adding languages, content types) becomes predictable
Conclusion: What’s the most efficient way to start clean with Jekyll?
Build once, reuse forever. Automating your Jekyll starter structure saves time, prevents errors, and sets every project on a path toward long-term maintainability. Whether you're creating internal docs, product sites, or SEO-optimized blogs—structure matters. And automation ensures structure is never left to chance.
Treat your starter repo like software: version it, document it, and make it easy for others to use.