Scaffold and Deploy a Jekyll GitHub Pages Blog in 5 Minutes
Ahnii!
Static websites have made a comeback. Innovations in content generation, the adoption of Markdown in workflows, deployment technology, and free hosting have made static websites an attractive option for those who don’t need the capabilities of a framework or content management system.
Why Static Sites?
- No server-side programming required
- Lightning-fast page loads
- Better SEO performance
- Simple deployment
- Free hosting options
Prerequisites
- Terminal (command-line interface)
- RubyGems
- Git
- GitHub account
Quick Start
Install Jekyll:
gem install bundler jekyll
Create your site:
jekyll new my-awesome-site
cd my-awesome-site
bundle exec jekyll serve
Visit http://localhost:4000 to preview your site.
Deploy to GitHub Pages
- Create a new repository:
- Go to https://github.com/new
- Name it “my-awesome-site”
- Leave it public
- Click “Create repository”
- Configure for GitHub Pages:
- Go to repository Settings
- Scroll to “GitHub Pages” section
- Select “master branch” as Source
- Save changes
- Update your Gemfile:
# Comment out this line
# gem "jekyll", "~> 3.8.4"
# Uncomment this line
gem "github-pages", group: :jekyll_plugins
- Configure _config.yml:
baseurl: "/my-awesome-site" # the subpath of your site
- Push to GitHub:
git init
git add .
git commit -m "first commit"
git remote add origin https://github.com/username/my-awesome-site.git
git push -u origin master
Visit https://username.github.io/my-awesome-site/ to see your live site!
Wrapping Up
You now have a working Jekyll blog hosted on GitHub Pages. To create new posts, simply add markdown files to the “_posts” directory following the naming convention: YYYY-MM-DD-title.md
.
How are you planning to use your new Jekyll blog? Share your ideas below!
Baamaapii 👋