Skip to content

Instantly share code, notes, and snippets.

@kumaraish
Last active December 31, 2020 10:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kumaraish/d101c8a779e534651c6709a46826bd33 to your computer and use it in GitHub Desktop.
Save kumaraish/d101c8a779e534651c6709a46826bd33 to your computer and use it in GitHub Desktop.
Installing Jekyll on Windows
References:
1. http://jekyllrb.com/docs/home/
2. https://labs.sverrirs.com/jekyll/
3. https://davidburela.wordpress.com/2015/11/28/easily-install-jekyll-on-windows-with-3-command-prompt-entries-and-chocolatey/
4. http://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages
Jekyll v3.x requires Ruby version >= 2.0.0.
Ruby installation
-installation via chocolatey
-via ruby installer (http://rubyinstaller.org/downloads/)
Install Ruby via Chocolatey
###Installing Chocolatey
@see https://davidburela.wordpress.com/2015/11/28/easily-install-jekyll-on-windows-with-3-command-prompt-entries-and-chocolatey/
First, ensure that you are using an administrative cmd.exe shell
λ @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
λ choco or choco -?
Uninstalling chocolatey
Remove Folder
C:\Chocolatey - for Chocolatey version < 0.9.8.27
C:\ProgramData\chocolatey > 0.9.8.27
NOTE: If you upgraded from 0.9.8.26 to 0.9.8.27 it is likely that Chocolatey is installed at C:\Chocolatey, which was the default prior to 0.9.8.27. If you did a fresh install of Chocolatey at version 0.9.8.27 then the installation folder will be C:\ProgramData\Chocolatey
Remove Environment Variables
ChocolateyInstall
ChocolateyBinRoot
ChocolateyToolsLocation
PATH (will need updated to remove)
###Installing Ruby
λ choco install ruby -y
Install Ruby via ruby installer for windows
Download and run installer (http://rubyinstaller.org/downloads/)
λ ruby --version
ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32]
λ gem --version
2.5.2
Updating Ruby gems version to prevent against ssl errors
Follow (http://guides.rubygems.org/ssl-certificate-update/) on this error- SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
Updates in the infrastructure of Ruby may cause SSL errors when attempting to use gem install with versions of the RubyGems package older than 2.6. (The RubyGems package installed via the Chocolatey tool is version 2.3) If you have installed an older version, you can update the RubyGems package using the directions here
Download the latest RubyGems (https://rubygems.org/pages/download)
λ gem install --local ./rubygems-update-2.6.12.gem
λ update_rubygems
λ gem --version
λ gem uninstall rubygems-update -x (You can now safely uninstall rubygems-update gem)
If the above fails then do
λ gem update --system
Install Ruby DevKit
Download and extract to C:\RubyDevKit\
Next, you need to initialize the DevKit and bind it to your Ruby installation
λ cd C:\RubyDevKit
λ ruby dk.rb init
λ ruby dk.rb review
λ ruby dk.rb install
***
Jekyll installation (http://jekyllrb.com/docs/windows/#installation)
Reopen a command prompt and install Jekyll:
λ gem install jekyll
λ gem install bundler
Helpful gems for Jekyll
Syntax highlighter
λ gem install rouge
***
Create a site
# Create a new Jekyll site at ./myblog
~ $ jekyll new myblog
# Change into your new directory
~ $ cd myblog
# Build the site on the preview server
~/myblog $ bundle exec jekyll serve
# Now browse to http://localhost:4000
***
Jekyll gem-based Themes (http://jekyllrb.com/docs/themes/)
Overriding existing theme -
Location of the existing theme (e.g. minima) files-
λ bundle show minima
C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/minima-2.1.1
Let’s say you want to override Minima’s footer. In your Jekyll site, create an _includes folder and add a file in it called footer.html. Jekyll will now use your site’s footer.html file instead of the footer.html file from the Minima theme gem.
Installing a new theme-
Search for a theme here - https://rubygems.org/search?utf8=%E2%9C%93&query=jekyll-theme
# Add the theme to your site’s Gemfile:
gem "jekyll-theme-cayman"
# Install the theme:
bundle install
# Add the following to your site’s _config.yml to activate the theme:
theme: jekyll-theme-cayman
# Build your site:
bundle exec jekyll serve
# Optionally, if you'd like to preview your site on your computer, add the following to your site's Gemfile:
gem "github-pages", group: :jekyll_plugins
or, follow instructions (http://jekyllrb.com/docs/github-pages/)
# add the following to your Gemfile
source 'https://rubygems.org'
require 'json'
require 'open-uri'
versions = JSON.parse(open('https://pages.github.com/versions.json').read)
gem 'github-pages', versions['github-pages']
# Run
λ bundle update github-pages
# Edit theme (http://jekyllrb.com/docs/structure/)
λ bundle show jekyll-theme-cayman
C:/tools/ruby23/lib/ruby/gems/2.3.0/gems/jekyll-theme-cayman-0.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment