Welcome! I just made this website with Jekyll
, an open source static page generator, and I’m hosting it using GitHub Pages
. All the services I used are 100% free. I’m currently using this grape-theme
with only a few modifications to the original code. You can find my source code here.
This serves as a guide on launching your github website using Jekyll and Github Pages.
Prerequisites
Skills
- Basic HTML and CSS
- Git
Installations
- Ruby (programming language)
- Git (version control)
- GitHub (you need an account)
- Bundler
- Here is a complete installation guide from the Jekyll website.
Outline
- Get started with Github.
- Find a theme for your Jekyll site.
- Personalize your Jekyll site.
- Deploy your site to GitHub pages.
- Write your first blog post.
1. Get started with GitHub.
- Sign in to your GitHub account.
- Create a new repository and name it
[username].github.io
, replacing[username]
with your GitHub username. Be sure the first part of the repo name exactly matches your username and that you set your repository to public. Otherwise, it will not work. - Create a
.gitignore
file and add the following line:_site/
. This file tellsgit
to ignore the_site
directory that Jekyll automatically generates each time a commit is made. - Open your terminal and create a local copy of your website on your computer using the command below.
git clone https://github.com/[username]/[username].github.io.git
This way you can always preview your Jekyll site first before pushing it to GitHub pages.
2. Find a theme for your Jekyll site.
- You can find, preview, and download themes for your Jekyll site on different galleries found online such as the following:
- Once you’ve chosen a theme, download and extract the file to your local git repository at
~../[username].github.io/
.You can always choose to write your own HTML and CSS independently. I just find it much more convenient and time-efficient to pick a pre-made theme and personalize it to my liking.
- On you local
git
repository, install dependencies for your Jekyll site.bundle install
- Finally, run the server to test your site locally.
bundle exec jekyll serve
It should be up and running at
http://localhost:4000/
.
3. Personalize your Jekyll site.
- Your Jekyll site’s configuration variables can be found at the file called
config.yml
. You can fill out missing fields or replace unwanted variables completely, and it will look a lot like the code block below.# Site Settings baseurl: "" url : "https://jennieablog.github.io" # Blog Settings theme_settings : title : "Jennie Ablog" favicon : "assets/favicon.ico" # Profile Settings profile : image : "assets/img/profile.jpg" username : "Jennie Ablog" description : "A BSc CS student who loves to teach herself a lot of stuff. 👩🏾💻"
- Once you’re already satisfied with the way it looks on your
localhost
, you can proceed to deployment to GitHub Pages.
4. Deploy your site to GitHub Pages.
- Fire up your terminal and navigate to your local git repository.
git add .
- Commit your changes.
git commit -m "initial commit for jekyll site"
- Push changes to master branch to deploy your site to GitHub pages.
git push origin master
- After a while, you can view your Jekyll Site running at
[username].github.io
.
5. Write your first blog post.
- Downloaded Jekyll themes usually come with sample blog posts which are located in a folder named
posts/
. - Navigate to that folder. You will see files that are likely named in this format
YYYY-MM-DD-sample-blog-post.md
. When you open it it will look something like anhtml
file except that it has something else in the beginning.--- layout: post title: title subtitle : subtitle tags: [tag1, tag2] author: comments : ---
-
What you see in the beginning of the file is called a
yaml
Front Matter block. Between the triple-dashed lines, you can set predefined variables or even define your own. They will then be made available for access using Liquid tags in the file. For more information on Front Matter, visit this page. - After writing your blog post, you can
git commit
andgit push
again to the master branch of yourgit
repository. Your website shall be updated accordingly.
When in doubt, you can always consult the Jekyll documentation, or the
README.md
of the GitHub repository of your chosen Jekyll theme, like this one or this one.
Well done! 🙆🏽♀️
You now have your own portfolio/blog website hosted for free for-ever!