Run Jekyll project on local machine

1 minute read

Step 1: Install Ruby

  • Download and install ruby from here: https://rubyinstaller.org/downloads/

Step 2: Install bundle

  • Go to the root directory of the project. Ex. My-blog
  • Run the following command in the terminal
bundle install

Step 3: Run the application

  • Go to the root directory of the project. Ex. My-blog
  • Run the following command in the terminal
bundle exec jekyll serve

Step 4: Output

  • Browse application using: http://127.0.0.1:4000/ to see the output

Step 5: Build and release for production

  • Go to the root direcotry
  • Run command jekyll build site.url
  • For your you will see _site is created or updated.
  • Copy the content of the _site
  • Pest the content to mahedee.github.io
  • Commit and push both repo - my-blog and mahedee.github.io
  • Now browse the blog site

Troubleshooting

  • How to change site URL in Jekyll when switching from development to production

    • You need not change links in production and development. You can conveniently set the “url” param in config.yml.
    • This does two things,
      • when you do a jekyll serve and serve the site locally then site.url is set to localhost:4000
      • when you do a jekyll build site.url is replaced by whatever domain name you set in the config.
      • Post this you can deploy the _site to the root of your server where your domain points to.

Archive

Run Jekyll project locally

Here is the list of tools or plugins I needed to install to run the blog locally.

Windows

  1. Install jekyll on windows

VSCode extensions

  1. Markdown All in One
  2. Code Spell Checker

Steps

  1. run bundle install (first time only)
  2. bundle exec jekyll serve to serve the application

Tools that didn’t work

For some unknown reason, installing via choco didn’t didn’t work.

  1. Chocolatey (Kept)
  2. Jekyll (Removed)