Link Search Menu Expand Document

Build your first website

You can build a new boilerplate website with a default gem-based theme by navigating to somewhere you would like to create your first project and running:

Input

$ jekyll new [name of blog]

The command above creates a new folder with the name of your blog in the current directory, which is populated with default content, such as an About page.

In order to view your website in a browser, you need to serve it with Jekyll. Jekyll will go through the files and compile them. To serve the simple website created above, run:

Input

$ jekyll serve

Jekyll will start a website on the localhost http://127.0.0.1 and port 4000. You can view your first website by opening this address on your browser:

$ http://127.0.0.1:4000

Instead of creating a new website using jekyll new, you can also clone a starting point to your local machine and serve it there. We will learn more about that in Themes.

If you have a Gemfile in the directory of the theme you found, you need to use Bundler to install all the gems before serving the website. Jekyll bundler is a gem that ensures compatibility of all the plugins across different environments with Jekyll installed on your system. You need to install Bundler after installing Jekyll:

Input

$ gem install bundler

Then, run the following command to serve the website:

Input

$ bundle exec jekyll serve

Jekyll monitors the project folder and rebuilds your website anytime you make a change. If you want to stop serving your website locally, use Ctrl + C.

You can learn more about the available commands for Jekyll here.