Generate static sites with Rails · a step by step guide
The Ruby ecosystem offers many static site generators - Jekyll, Middleman, Kamal Skiff, Sitepress, Bridgetown, High Voltage, Nanoc, ... - and countless more exist beyond Ruby.
The intent here is to remove one - to use Rails and all its magic goodies for both dynamic and static sites.
This is not a new framework. It's a thoughtful collection of existing gems that each excel at one task and integrate seamlessly with Rails.
This guide will teach you how to transform Rails into a powerful static site generator, leveraging a modern Hotwire stack. You will discover how to:
- Create a minimal Rails application optimized for static site generation
- Process markdown content with frontmatter using Decant and kramdown
- Deploy automatically to GitHub Pages with Parklife
- Use ERB template processing for dynamic content generation within markdown files
- Enhance user experience with Turbo Drive for instant page navigation
- Add interactive features using Stimulus controllers
- Manage JavaScript dependencies with Importmap for modern ES modules
- Implement live-reloading during development with Hotwire Spark
- Style your site effortlessly with classless CSS frameworks
- Add syntax highlighting to code blocks with Rouge
- Optimize for SEO with proper web page metadata and Open Graph tags
- Generate XML sitemaps and robots.txt files for search engines