This is not the first blog that I opened during the last 10 years. I tried multiple times with different technologies: Worpress and Joomla. I was spending more time on settings, themes and configurations than on content.
But over time you become more wiser, so this time I decided to focus on the content and not on technology. I found the combination of Github pages and Jekyll the best match for my purpose. In this article I want to show how easy is to setup a personal blog/site without lot of effort expecially if you have experience with GitHub ad Markdown.
Git Hub pages
Websites for you and your projects. Hosted directly from your GitHub repository. Just edit, push, and your changes are live.
Created mainly for website projects for the repositories, they are more and more used also as personal site. Creating it is very simple:
- Go to GitHub
- create a new public repository named username.github.io, where username is your username on GitHub.
- Clone your repo
git clone https://github.com/username/username.github.io
- add an index.md and push!
and that’s it! You can now access to your site at https://username.github.io The index page of your website can be a index.md file or a README.md file. If both exists the index.md file has priority. You can also put html, css and also js directly. For a full features refer to official docs.
If you want more power use Jekyll!
Transform your plain text into static websites and blogs.
- Simple: No more databases, comment moderation, or pesky updates to install—just your content.
- Static: Markdown, Liquid, HTML & CSS go in. Static sites come out ready for deployment.
- Blog-aware: Permalinks, categories, pages, posts, and custom layouts are all first-class citizens here.
I think there is nothing to add here.
Install on Windows
Yes, yes..I am using Windows. Why not? Expecially in the last years is not so bad. I wrote an article and maybe I will wrote another in this blog.
A part from that, you can install Jekyll on Windows in two main way:
In this case you need to install RubyInstaller since Jekyll is based on the ruby language. You can follow the guide I have to admit, I haven’t tried it.
You can use the Windows Subsystem for Linux, but the steps described in the guide on Jekyll site not worked for me so I just followed the installation for Ubuntu
sudo apt-get install ruby-full build-essential zlib1g-dev
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
gem install jekyll bundler
How to create a site
- Create a new Jekyll site at ./myblog.
jekyll new myblog
- Change into your new directory.
- Build the site and make it available on a local server.
bundle exec jekyll serve
- Browse to http://localhost:4000
The entry point for every configuration is the _config.yml file also for themes. You have two options to change the theme:
- Use one of GitHub default theme
In that case you need to change
replacing THEME-NAME with the name of the theme as shown in the README of the theme’s repository.
- Use a remote theme
Remote themes are theme hosted on Github. In that case you need to change
replacing THEME-NAME with the name of the theme as shown in the README of the theme’s repository. To run remote themes on your local machine you need to enable it on Gemfile adding
group :jekyll_plugins do ... gem "jekyll-remote-theme" ...
You can customize a theme simple overring it’s files. Usually a theme places it’s files in this directories: assets, _layouts, _includes, and _sass. So for example if your theme has a layout called home.html” to override it you must create, in your site home directory, the folder *_layouts and put the *home.html” files. You can copy the orignal one and modify it or you can simple create one from scratch, but the name must match. This is valid also for the files in other directories.
There are some limitations when using Jekyll on GitHub pages and one is that you cannot use all the plugin that you want but only some that are approved by GitHub. Here you can find the list. If you want to use unsupported plugins, generate your site locally and then push your site’s static files to GitHub.