Use Jekyll Tool To Create Github Blog
This website was created with Jekyll tool and hosted on Github repository. You can use Jekyll to create a GitHub Pages site in a new or existing repository.
- Install Ruby on your OS. https://www.ruby-lang.org/en/downloads/
-
Install Bundler
gem install bundleInstall Jekyll. Install the version of Jekyll which Github pages has dependency to. Dependency versions
To install specific version of Jekyll.
gem install jekyll -v <VERSION> -
Create a repository for your Github site. Follow the instructions on Github help pages
-
After creating the repository on Github. Clone the project to your local computer.
git clone https://<path-to-github-repository>/<github-repository>.git -
Go to the project directory on your local computer.
cd <path-to-project> -
Create a new bundle project.
bundle initThis creates a new Bundler project (by creating an empty Gemfile)
-
Configure Bundler. This step is optional, but encouraged. We’re going to configure Bundler to install gems in the ./vendor/bundle/ project subdirectory. This allows us to install our dependencies in an isolated environment, ensuring they don’t conflict with other gems on your system. If you skip this step, Bundler will install your dependencies globally on your system.
bundle install --path vendor/bundle -
In the configuration file Gemfile, uncomment the line:
gem "github-pages", group: :jekyll_pluginsComment the line:
gem "jekyll", "~> <VERSION>" -
Create a Jekyll Scaffold. Now that Jekyll is installed, we can use it to create the scaffolding for our site. We need the –force parameter because our folder isn’t empty - it already has some Bundler files in it. We run the bundle install separately because Jekyll gets confused if the Gemfile already exists.
bundle exec jekyll new --force --skip-bundle . bundle install -
Serve the SitePermalink. Your new website is ready! You can serve the website with
bundle exec jekyll serveand visit it at http://127.0.0.1:4000. From here, you’re ready to continue developing the site on your own. All of the normal Jekyll commands are available to you, but you should prefix them with bundle exec so that Bundler runs the version of Jekyll that is installed in your project folder. - Commit to Source ControlPermalink. If you’re storing your new site in version control, you’ll want to ignore the ./vendor/ and ./.bundle/ folders since they contain user- or platform-specific information. New users will be able to install the correct dependencies based on Gemfile and Gemfile.lock, which should both be checked in. You can use this .gitignore to get started, if you want.
.gitignore
# Ignore metadata generated by Jekyll
_site/
.sass-cache/
.jekyll-cache/
.jekyll-metadata
# Ignore folders generated by Bundler
.bundle/
vendor/
References:
- Creating a GitHub Pages site with Jekyll - https://help.github.com/en/github/working-with-github-pages/creating-a-github-pages-site-with-jekyll
- About GitHub Pages and Jekyll - https://help.github.com/en/github/working-with-github-pages/about-github-pages-and-jekyll