GitHub Pages Documentation
This guide explains how to develop and deploy the documentation site that’s hosted on GitHub Pages. The documentation uses Jekyll with the Just-the-Docs theme.
Overview
The documentation site is built with:
- Jekyll 4.3.3 - Static site generator
- Just-the-Docs - Jekyll theme for documentation
- Ruby - Runtime for Jekyll and gems
- Bundler - Ruby dependency manager
- GitHub Pages - Hosting platform
Live Site: https://patrykquantumnomad.github.io/financial-data-extractor/
Prerequisites
Before developing the documentation locally, you need:
Required Software
- Ruby (3.0.0 or higher)
- Check version:
ruby --version - Install: Use
rbenv,rvm, or system package manager - Recommended: Ruby 3.3.1 or newer
- Check version:
- Bundler (Ruby gem manager)
- Check version:
bundle --version - Install:
gem install bundler - Recommended: Bundler 2.7.2 or newer
- Check version:
Verify Installation
ruby --version
# Should output: ruby 3.3.1 (or similar)
bundle --version
# Should output: Bundler version 2.7.2 (or similar)
Project Structure
The documentation is located in the docs/ directory:
docs/
├── _config.yml # Jekyll configuration
├── Gemfile # Ruby dependencies
├── Gemfile.lock # Locked dependency versions
├── index.md # Home page
├── _includes/ # Reusable components
├── _sass/ # Custom styles
├── assets/ # Images, CSS, JS
└── [sections]/ # Documentation pages
├── index.md
└── [sub-pages].md
Local Development Setup
1. Install Dependencies
Navigate to the docs/ directory and install Ruby dependencies:
cd docs
bundle install
This command:
- Reads
Gemfileto determine required gems - Installs Jekyll, Just-the-Docs, and other dependencies
- Creates
Gemfile.lockto lock versions - Installs gems to a local bundle (isolated from system gems)
2. Start Local Server
Start the Jekyll development server with live reload:
bundle exec jekyll serve --livereload
Alternative commands:
# Without live reload (faster, but requires manual refresh)
bundle exec jekyll serve
# On a specific port
bundle exec jekyll serve --port 4001
# Watch for changes (default)
bundle exec jekyll serve --watch
# Build only (no server)
bundle exec jekyll build
3. Access Local Site
Once the server starts, you’ll see output like:
Server address: http://127.0.0.1:4000/financial-data-extractor/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Open the URL in your browser. The site automatically reloads when you make changes to Markdown files.
4. Stop Server
Press Ctrl+C in the terminal to stop the Jekyll server.
Ruby, Gem, and Bundle Commands
Ruby Commands
Ruby is the programming language Jekyll is built on:
# Check Ruby version
ruby --version
# Run a Ruby script
ruby script.rb
# Interactive Ruby (IRB)
irb
Gem Commands
Gems are Ruby packages. Jekyll and its dependencies are gems:
# List installed gems
gem list
# Install a gem globally
gem install jekyll
# Uninstall a gem
gem uninstall jekyll
# Update a gem
gem update jekyll
# Search for gems
gem search jekyll
# Show gem information
gem info jekyll
Note: For this project, we use Bundler to manage gems instead of installing them globally.
Bundle Commands
Bundler manages gem dependencies for a project:
# Install dependencies from Gemfile
bundle install
# Update all gems to latest versions (updates Gemfile.lock)
bundle update
# Update a specific gem
bundle update jekyll
# Check if dependencies are satisfied
bundle check
# Show installed gems
bundle list
# Show outdated gems
bundle outdated
# Execute a command in the bundle context
bundle exec jekyll serve
Why bundle exec?
- Ensures you use the exact gem versions from
Gemfile.lock - Prevents conflicts with globally installed gems
- Always use
bundle execfor Jekyll commands in this project
Common Development Tasks
Adding a New Page
- Create a new
.mdfile in the appropriate directory:docs/your-section/new-page.md - Add front matter (YAML header):
--- layout: default title: Page Title description: Page description nav_order: 1 parent: Parent Section --- - Write content in Markdown
- The page appears automatically in the navigation
Editing Navigation
Navigation is controlled by front matter in each page:
nav_order: Determines position in navigation (lower numbers appear first)parent: Sets parent section (creates hierarchy)has_children: true: Indicates section has sub-pages
Adding Diagrams
The site supports Mermaid diagrams:
```mermaid
graph LR
A[Start] --> B[End]
```
See Mermaid Documentation for syntax.
Previewing Changes
- Make changes to
.mdfiles - Save the file
- Jekyll automatically rebuilds (watch mode)
- Browser reloads automatically (with
--livereload) - Check for errors in the terminal
Troubleshooting Build Errors
Common Issues:
- Missing dependencies:
bundle install - Outdated gems:
bundle update - Port already in use:
bundle exec jekyll serve --port 4001 - Build errors:
- Check YAML front matter syntax
- Verify Markdown links use
.htmlextension - Check for broken internal links
- Clear build cache:
rm -rf _site bundle exec jekyll build
VS Code Tasks
A VS Code task is configured for running Jekyll:
Task Name: “Jekyll: Serve”
Usage:
- Open Command Palette (⌘⇧P / Ctrl+Shift+P)
- Type “Tasks: Run Task”
- Select “Jekyll: Serve”
- Task runs in background terminal
- Documentation available at
http://localhost:4000
Configuration: See .vscode/tasks.json
GitHub Pages Deployment
Automatic Deployment
Documentation is automatically deployed to GitHub Pages when:
- Changes are pushed to
mainbranch - Changes are in the
docs/directory - GitHub Actions workflow runs successfully
Workflow File: .github/workflows/jekyll-gh-pages.yml
Deployment Process
The GitHub Actions workflow:
- Triggers on push to
mainwhendocs/**files change - Checks out the repository
- Sets up Ruby and installs dependencies
- Builds the Jekyll site (
bundle exec jekyll build) - Deploys to GitHub Pages
Build Output: docs/_site/ directory
Manual Deployment
You can also trigger deployment manually:
- Go to Actions tab in GitHub
- Select “Deploy Jekyll site to Pages” workflow
- Click “Run workflow”
- Select branch (usually
main) - Click “Run workflow”
Deployment Status
- Check deployment status in Actions tab
- View live site: https://patrykquantumnomad.github.io/financial-data-extractor/
- Deployment typically takes 1-2 minutes
Configuration Files
_config.yml
Main Jekyll configuration file:
- Site metadata: Title, description, email
- Theme: Just-the-Docs theme settings
- Base URL:
/financial-data-extractor(GitHub Pages path) - Search: Enabled with custom configuration
- Mermaid: Diagram rendering configuration
File: docs/_config.yml
Gemfile
Ruby dependencies for the documentation site:
- Jekyll 4.3.3 - Static site generator
- just-the-docs - Documentation theme
- jekyll-feed - RSS feed plugin
- webrick - Required for Ruby 3.0.0+
- csv - Required for Ruby 3.4.0+
File: docs/Gemfile
Gemfile.lock
Locked versions of all dependencies. This ensures:
- Consistent builds across environments
- Reproducible deployments
- Version stability
Important: Commit Gemfile.lock to version control.
Best Practices
Documentation Writing
- Use Markdown: Write content in Markdown format
- Link Format: Use
.htmlextensions for internal links (e.g.,[Page](page.html)) - Front Matter: Always include proper front matter in each file
- Navigation: Use
nav_orderto control page order - Diagrams: Use Mermaid for visual diagrams
Version Control
- Commit Changes: Commit Markdown files and configuration
- Gemfile.lock: Always commit
Gemfile.lock - Test Locally: Build locally before pushing to catch errors
- Review: Review changes in local build before deployment
Performance
- Optimize Images: Compress images before adding to
assets/ - Minimize Custom CSS: Use theme defaults when possible
- Clean Builds: Clear
_site/directory if experiencing issues
Troubleshooting
Ruby Version Issues
Problem: Wrong Ruby version or missing Ruby
Solution:
# Install Ruby version manager (rbenv recommended)
brew install rbenv ruby-build
# Install Ruby 3.3.1
rbenv install 3.3.1
rbenv global 3.3.1
# Verify
ruby --version
Bundle Install Fails
Problem: bundle install fails with errors
Solution:
# Update Bundler
gem update bundler
# Clear gem cache
bundle clean --force
# Try again
bundle install
Jekyll Server Won’t Start
Problem: Server fails to start or port conflicts
Solution:
# Check if port is in use
lsof -i :4000
# Use different port
bundle exec jekyll serve --port 4001
# Clear build cache
rm -rf _site
bundle exec jekyll serve
Build Errors
Problem: Jekyll build fails with errors
Solution:
- Check YAML front matter syntax
- Verify all links use
.htmlextension - Check for missing dependencies:
bundle install - Review error messages in terminal
- Clear build cache:
rm -rf _site
Additional Resources
- Jekyll Documentation
- Just-the-Docs Theme
- GitHub Pages Documentation
- Bundler Documentation
- Ruby Documentation
Related Documentation
- Cursor IDE Configuration - IDE setup and configuration
- Getting Started Guide - Project setup
- Documentation Standards - Documentation best practices