Photo by HalGatewood.com on Unsplash · 19/9/2016
Having a website on internet is a very powerful tool, you can create a tech blog, like mine, a site with your curriculum vitae, a portfolio, whatever you want. Being on internet increases your visibility and let other people know who you are, what do you do, or other information you consider important. But if you dedicate yourself to technology, computers, development and so on, you must have your space on internet. No excuses.
There are literally a lot of ways (platforms, CMS, etc.) to create your own site on internet: WordPress, Medium, Ghost… But today, I’m introducing you an static site generator named Jekyll.
Jekyll is a CMS that offers a different way to put your content on internet, with support for images, texts, comments, etc. What differences Jekyll from other CMS like WordPress or Ghost, is that Jekyll is just a tool to transform your plain text into a website or blog. No databases, no configurations, just your plain text, images, videos, etc.
You may prefer having a WordPress hosted in WordPress.com, but what if I told you Jekyll may be hosted for free using GitHub pages even with your own domain?. GitHub will provide a free hosting on its servers with high availability and Cloudflare will help configuring your domain. Sounds great, huh?
I’m sure you are prepared to give a try to Jekyll and that’s why I’m going to explain in this article how you can create your own website/blog using it.
In GitHub you can create websites for yourself, your projects or your organization. Follow these steps to create a repository to host Jekyll:
In the previous step we have created a repository that will be the hosting for our Jekyll website, in this step we are going to deploy Jekyll into GitHub pages. Open a Terminal and type:
# IMPORTANT: Replace <username> with your GitHub username.
# Install Jekyll using gem
gem install jekyll bundler
# Create a new Jekyll website
jekyll new <username>.github.io
cd <username>.github.io
bundle install
Before uploading your website you must edit _config.yml to configure your domain name. Open _config.yml and edit this line with your GitHub domain https://<username>.github.io.
url: "https://<username>.github.io" # the base hostname & protocol for your site
Finally, go back to your terminal and push your website to GitHub.
# IMPORTANT: Use your username instead of <username>
# Push your fresh install to your repository
git init
git remote add origin [email protected]:<username>/<username>.github.io.git
git add .
git commit -m "Initial commit"
git push origin master
That’s all! Your website will be available at: https://<username>.github.io
Jekyll is just static content but that doesn’t mean you can’t personalize it with a wonderful theme. In this step I’m going to show you static doesn’t mean ugly.
url: "https://<username>.github.io" # the base hostname & protocol for your site
baseurl: ""
jekyll build
git add .
git commit -m "Install new theme"
git push origin master
That’s all, your website will have a fantastic appearance, actually it looks quite professional:
As I’ve told you before, Jekyll is all about plain content, no databases, no dynamic things, just your text. Creating a new post is quite simple, let’s do it:
--
layout: post
title: "Welcome to my website!"
date: 2016-09-20 20:28:40 +0200
collection: offtopic
---
Hi, my name is Adrián Gómez and I'm pleased to welcome you to my new blog.
This blog is using Jekyll and this is just a post example.
{% highlight javascript %}
// Jekyll has syntax highlighter for Javascript too.
console.log('Hello World!');
{% endhighlight %}
And we also [have links!][link-example]
[link-example]: https://adgllorente.com
After writing your post you only have to build Jekyll and push this into GitHub like this:
# Build your site
jekyll build
# Push to github
git add .
git commit -m "Write new post"
git push origin master
In the image below you can see an example of your recently created post:
For more information about posting or configuring Jekyll:
I’m mostly a frontend developer and I’m not used to configure Apache, Bind, Ftp, Linux Users, etc. but I own a dedicated server, and that means I have to configure all of them, and so do I. But configuring domain names is my Achilles’ heel and that’s why I’m using Cloudflare.
Cloudflare is not only a DNS manager, it provides extra tools to boost your website speed. To start using it you need to create an account, add a domain name and change your domain DNS to point to Cloudflare’s DNS servers. In this step I’m supposing you already have a domain name configured in Cloudflare. You can follow this guide if you don’t have one.
In this example I’m using a subdomain testjekyll.adgllorente.com to point to my Jekyll page but if you want to configure a domain instead of a subdomain you only have to follow almost the same steps but filling information with your domain instead of your subdomain.
First of all we need to tell GitHub we are configuring our own domain name:
Now we need to configure our domain name in Cloudflare:
Your domain name is fully configured with just these steps, you can test it visiting your domain, in my case adgllorente.github.io.
Cloudflare has a lot of tools but I’m going to review a few of them to boost your site performance:
That’s all! Your website will loads in seconds with just a few changes.
Jekyll has a few pros:
But it also has a few cons:
In my opinion, Jekyll is a good choice if you are a developer, you don’t mind using GIT to push updates and you love plain text to save information. Jekyll is also a good choice for small projects like an App Landing Page, a curriculum vitae, etc. but I won’t use it for a big project or for a very special project.
· Adrián Gómez
Powered by Astro + TailwindCSS + Markdown