Home β€Ί Blog β€Ί Using Jekyll for Open Source Project Documentation
Tutorial

Using Jekyll for Open Source Project Documentation

Jekyll is the default documentation platform for thousands of open source projects on GitHub. Here is how to set up, structure, and maintain great project docs with Jekyll.

Using Jekyll for Open Source Project Documentation

Jekyll powers documentation for thousands of open source projects β€” Bootstrap, Jekyll itself, GitHub’s own docs, and hundreds of others. It is the natural choice for projects already hosted on GitHub, and the most supported static site generator on GitHub Pages.

Here is how to set up professional documentation for your open source project.

Why Jekyll for open source docs

  • GitHub Pages native support β€” push to a docs/ folder or gh-pages branch and your docs are live instantly
  • Markdown-first β€” contributors already write Markdown for README files; docs are the same workflow
  • No build step required β€” GitHub Pages builds Jekyll automatically on every push
  • Versioned with your code β€” docs live in the same repository as code, so pull requests can include both code and doc changes
  • Free β€” no hosting cost for open source projects

Two approaches: docs in the repo vs separate docs site

Option A: docs/ folder in your main repository

Jekyll can build from a docs/ folder in your repository. This keeps docs alongside code β€” ideal for small to medium projects.

In your GitHub repository settings β†’ Pages β†’ Build and deployment, set the source to β€œDeploy from a branch” and the folder to /docs.

Option B: Separate gh-pages branch

Larger projects often use a dedicated gh-pages branch for documentation. This keeps the main branch clean and allows the docs to have their own git history.

Setting up the docs folder

docs/
β”œβ”€β”€ _config.yml
β”œβ”€β”€ _layouts/
β”‚   β”œβ”€β”€ default.html
β”‚   └── page.html
β”œβ”€β”€ _includes/
β”‚   β”œβ”€β”€ nav.html
β”‚   └── sidebar.html
β”œβ”€β”€ assets/
β”‚   β”œβ”€β”€ css/
β”‚   └── js/
β”œβ”€β”€ index.md          # Landing page / introduction
β”œβ”€β”€ getting-started.md
β”œβ”€β”€ installation.md
β”œβ”€β”€ configuration.md
β”œβ”€β”€ api/
β”‚   β”œβ”€β”€ overview.md
β”‚   └── reference.md
└── guides/
    β”œβ”€β”€ quickstart.md
    └── advanced.md

_config.yml for project docs

title: "YourProject Documentation"
description: "The official documentation for YourProject β€” a [brief description]."
url: "https://yourorg.github.io"
baseurl: "/your-project"

# Theme β€” just-the-docs is the most popular Jekyll docs theme
remote_theme: just-the-docs/just-the-docs

# Navigation order
nav_order: true

# Search
search_enabled: true

# Footer links
footer_content: "Copyright © 2026 YourProject Contributors."

# GitHub link
gh_edit_link: true
gh_edit_link_text: "Edit this page on GitHub"
gh_edit_repository: "https://github.com/yourorg/your-project"
gh_edit_branch: "main"
gh_edit_source: docs

The Just the Docs theme

Just the Docs is the most popular Jekyll theme for open source documentation. It provides:

  • Responsive sidebar navigation with automatic TOC
  • Full-text client-side search
  • Collapsible navigation sections
  • Breadcrumbs
  • Dark mode
  • Code block copy buttons
  • Custom callout blocks

To use it with GitHub Pages, add to _config.yml:

remote_theme: just-the-docs/just-the-docs

No Gemfile changes needed for GitHub Pages.

Structuring documentation with front matter

Just the Docs uses front matter to control the navigation:

---
layout: default
title: "Getting Started"
nav_order: 2
description: "How to install and set up YourProject in under 5 minutes."
permalink: /getting-started/
---

Parent-child navigation for nested sections:

# Parent page
---
title: "API Reference"
nav_order: 4
has_children: true
---

# Child page
---
title: "Authentication"
parent: "API Reference"
nav_order: 1
---

Writing great documentation

Every docs site needs these pages:

  • Introduction β€” What is the project? Who is it for? What problem does it solve?
  • Installation β€” The first thing every new user reads. Be thorough.
  • Quickstart β€” Get from zero to working example in 5 minutes or less
  • Configuration reference β€” Every configuration option documented, with type, default, and example
  • API reference (for libraries) β€” Every public method, parameter, and return value
  • Changelog β€” What changed in each version

Documentation writing principles:

Write for a reader who has never seen your project. Avoid assuming knowledge. Every code example should be copy-paste runnable. Include expected output.

Use callout boxes for warnings, tips, and important notes:

{: .warning }
This configuration option was deprecated in v2.0. Use `new_option` instead.

{: .note }
This feature requires YourProject v1.5 or higher.

Version-specific documentation

For projects with multiple active versions, use Jekyll collections:

# _config.yml
collections:
  v2:
    output: true
    permalink: /v2/:path/
  v3:
    output: true
    permalink: /v3/:path/

Or use a branch per version and configure separate GitHub Pages deployments.

Automating docs with GitHub Actions

Auto-build and deploy on every push to main:


# .github/workflows/docs.yml
name: Deploy Docs

on:
  push:
    branches: [main]
    paths: ["docs/**"]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
          working-directory: docs
      - run: bundle exec jekyll build
        working-directory: docs
      - uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: docs/_site

Alternatives to consider

Jekyll is excellent for documentation but not the only option. Compare before committing:

Tool Best for
Jekyll + Just the Docs GitHub-hosted projects, Markdown-native teams
Docusaurus React-based projects, versioned docs, MDX
MkDocs Python projects, simple setup
GitBook Teams wanting a hosted, no-build solution
ReadTheDocs Python/Sphinx projects, automatic versioning

For projects already on GitHub with a Markdown-writing team, Jekyll on GitHub Pages is the fastest path from code to professional documentation β€” often taking less than an hour to set up.


Writing API reference documentation with Jekyll

For libraries and tools with a public API, the reference documentation is often the most-visited section of the docs. It needs to be comprehensive, consistent, and easy to scan.

A practical pattern for API reference in Jekyll is to use a collection (_api/) with structured front matter, then render the reference with a layout that displays all fields uniformly:

# _api/authenticate.md
---
title: authenticate()
nav_order: 1
parent: Authentication
method: POST
endpoint: /api/v1/auth
returns: "AuthToken object"
since: "1.0"
parameters:
  - name: username
    type: string
    required: true
    description: "The user's login name"
  - name: password
    type: string
    required: true
    description: "The user's password"
  - name: remember_me
    type: boolean
    required: false
    default: "false"
    description: "Keep the session active for 30 days"
---

Returns an authentication token for use in subsequent requests.

## Example

```bash
curl -X POST https://api.example.com/v1/auth \
  -H "Content-Type: application/json" \
  -d '{"username": "alice", "password": "secret"}'

Response

{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."}

The `_layouts/api-method.html` layout renders the `parameters` array from front matter into a structured table, ensuring consistent presentation without the API author needing to write the table HTML manually. This is one of Jekyll's strongest use cases: structured content with consistent display, managed through front matter schemas rather than free-form Markdown.

## Keeping docs in sync with code changes

Documentation drift β€” docs that no longer match the code β€” is the most common problem in open source project documentation. Readers encounter outdated examples, deprecated APIs, or missing configuration options and lose trust in the docs.

Several practices reduce drift. Requiring that PRs which change a public API also update the relevant docs page, enforced through a PR template checklist. Adding a `last_reviewed:` front matter field to docs pages and a CI check that warns when pages have not been reviewed in more than six months. Using `gh_edit_link: true` in your Just the Docs config so every page has an "Edit this page" link β€” lowering the barrier for contributors to fix small inaccuracies when they notice them.

For API reference specifically, consider generating documentation from code annotations automatically. Tools like YARD (Ruby), JSDoc (JavaScript), and Sphinx (Python) can generate Markdown or HTML from code comments, which can then be included in your Jekyll docs site. This eliminates the synchronisation problem entirely β€” the documentation is the source code.

## Search in open source documentation

Just the Docs includes client-side search out of the box, powered by Lunr.js. All indexed content is included in a JSON file at `/assets/js/search-data.json`, which is generated by Jekyll at build time. The search works on GitHub Pages without any additional setup or external service.

For larger documentation sites β€” more than a few hundred pages β€” Algolia DocSearch is worth considering. DocSearch is a free service from Algolia specifically for open source documentation. You apply with your project's documentation URL, Algolia crawls it and creates an index, and you add their JavaScript snippet. The result is significantly faster and more accurate search than Lunr.js, with typo tolerance and instant results as you type.

DocSearch eligibility requires that the documentation is publicly available and free. Most open source projects qualify. Apply at [docsearch.algolia.com](https://docsearch.algolia.com) β€” the setup typically takes a few days for the crawl and review.

## Localisation and multi-language docs

International open source projects sometimes need documentation in multiple languages. Jekyll handles this through collections or separate subdirectories per language, with URL prefixes like `/en/`, `/ja/`, `/de/`.

The simplest approach uses Jekyll's `_config.yml` to define multiple collections:

```yaml
collections:
  en:
    output: true
    permalink: /en/:path/
  ja:
    output: true
    permalink: /ja/:path/

Add a language switcher to your navigation include that links to the equivalent page in each language. Front matter on each page stores the lang field and a translation_key that identifies which pages are translations of each other.

Maintaining multi-language docs is a significant ongoing commitment β€” it is best to start with one language and add translations when you have active contributors in a specific language community rather than attempting multi-language docs from the beginning.

Analytics for documentation sites

Understanding how readers use your documentation guides prioritisation decisions. Which pages are most visited? Where do readers drop off? Which sections generate the most support questions?

Plausible Analytics is the best choice for open source project documentation β€” it is lightweight (< 1kb), privacy-respecting (no GDPR consent banner needed), and has a public dashboard option that lets you display your stats to the community. Install it by adding a single script tag to your documentation layout, gated behind {% if jekyll.environment == "production" %} so it does not fire during local development.

Track custom events for key interactions: documentation search queries, code copy button clicks, and external link clicks to GitHub or the project’s main site. These events reveal how users navigate from documentation to the actual project, informing where to place links and calls to action.

Check Google Search Console monthly for documentation sites with external traffic. The queries that bring visitors to your docs are a direct signal about what users are searching for β€” often revealing gaps in your documentation structure where users cannot find what they need and turn to Google instead. Each gap is a prioritised documentation task.

Open source documentation on Jekyll is one of the best combinations of tool and use case in the static site world. The workflow β€” write Markdown in the same repository as your code, submit PRs that bundle code and doc changes together, deploy automatically on every push β€” is as close to frictionless as documentation gets. Browse the Jekyll themes collection on JekyllHub for documentation themes that go beyond Just the Docs if you want more design flexibility for your project’s public presence.

Using Jekyll for project documentation is a decision that ages well. The combination of GitHub-native hosting, Markdown content, version-controlled documentation, and a thriving theme ecosystem means your docs infrastructure gets better over time rather than accumulating technical debt. The Just the Docs theme alone is a mature, well-maintained foundation used by hundreds of active open source projects. Whatever documentation structure you choose today, the underlying Jekyll platform will still support it in five years β€” and your docs will still be fast, accessible, and maintainable because they are nothing more than static HTML files hosted on GitHub’s infrastructure.

Starting small and growing your docs

Many successful documentation sites started with a single README.md converted into a Jekyll doc site with just a few pages. The most important thing is having clear, accurate content β€” structure and design can always be refined later. Start with your quickstart guide and API reference, then add guides, tutorials, and a changelog as the project grows. A simple doc site that is always up to date is more valuable than an elaborate one that lags behind the code.

Share LinkedIn