Blogging with Github Pages and Jekyll
I have decided to use a blog to store descriptions for my hobby projects. While I have a server I decided not to use it for blogging, because I don’t want to maintain it.
I have a Github account, so I used Github Pages together with Jekyll.
Here’s a description how I did it on Windows with WSL and Visual Studio Code.
Installation
- Create a Github repository with the following name
https://github.com/YourUsername/YourUsername.github.io
, see also here. - Clone the repo locally to your machine.
- Open your WSL command prompt.
- Install Ruby development tools, if necessary, see also here. E.g.
sudo apt install ruby-dev
- Install needed gems with
sudo gem install jekyll bundler github-pages
- Change directory to the local copy of the repo
- Create a new Jekyll site here with
jekyll new .
- I use Visual Studio Code with the extension Markdown All In One. Open directory in Visual Studio Code.
-
Add to the
Gemfile
source "https://rubygems.org" gem "github-pages", group: :jekyll_plugins
- Customize
_config.yml
, e.g. title, description, email, etc. - Run
bundle install
andbundle update
Blogging
- To add a new blog post, add a file
2020-01-12-blogposttitle.markdown
(change accordingly) to the sub-directory_posts
. See existing files for hints how to format. - Start blogging as markdown files.
- Build the site and make it available locally with
bundle exec jekyll serve --no-watch
- You can now open the blog in your browser at
http://127.0.0.1:4000
.
Publish at Github
- Git Commit and Push all files to your Github repo.
- Github builds the page and after a couple of minutes it should be available at https://YourUsername.github.io