How did I setup this blog?
Host the site
I heard about Github pages, and Jekyll and came to know that Github pages are powered by Jekyll. So, I wanted to host my blog in Github using Jekyll.
After understanding Github pages structure, I wanted to host my blog as project site, not as user site.
Because, If I set up my blog as user site, then http://saikiran.blog
should point tohttps://nsaikiran.github.io
.
Suppose If I want to have a page for any of my repositories, then that (https://nsaikiran.github.io/*repository*
) will live at http://saikiran.blog/*repository*
, which I didn’t like.
Then I chose a Jekyll theme, installed Jekyll and theme specific gems to run locally before pushing it to Github.
I created a repository for my blog. And pushed all the code to a specially named branch called gh-pages
.
Now I can access my blog from https://nsaikiran.github.io/blog
.
Useful references
- Jekyll doc
- Clarification about site.baseurl.
- Configuring Jekyll for User and Project GitHub Pages
- Absolute vs. Relative Paths/Links.
The above links helped me setting up the site properly as well as customizing it.
I’m new to Jekyll and using Github project site.
There was an issue with generating URLs. Because my blog doesn’t live at root,
rather it will be in sub-directory of root.
In _config.yml
, we can set url
and baseurl
with the other variables.
We use these variables to generate URLs/links, so these should be configured properly.
And sometimes using baseurl
might drive you crazy.
If you want to avoid the confusion around using baseurl
.
Unset the baseurl
and site.url
.
While generating links, instead of site.url
, use site.github.url
which will be set to https://*your-account*.github.io/*repository-name*
while in Github environment.
For more information refer Project Page URL Structure.
Setup custom domain
Bought a domain name under recently released top-level domain .blog
.
Steps:
- Configuring a GoDaddy domain name with GitHub pages.
- If you used
site.github.url
in link generation, you no need to do anything. - If you used
url
andbaseurl
in link generation, seturl
to the custom domain, in my casehttp://saikiran.blog
and unsetbaseurl
.
You have your site up and running. Now you can maintain the source code of your site like any other project codebase.