My tech blog built with Jekyll and published on Github pages. Uses the basically basic from this awesome guy.
- Posts go under _posts (or _drafts)
bundle exec jekyll serve
(check incremental builds, autogeneration)- Navigate to localhost:4000/
- Just push to the
gh_pagesmaster branch - Navigate to https://spygi.github.io/tech-blog/ (or the CNAME)
- The guide I followed: Github pages for Jekyll
- And vice versa: Jekyll for Github pages
- Metadata exposed from Github gem
-
Regarding repos/branches: You can use Github Pages once per user/organisation (special repository named "spygi.github.io", master branch) or per project (on master branch, master branch
/docs
folder or special "gh-pages" branch). This repo is using the per repo method with themaster
branch (not /docs). Serving through Github pages -
_site is .gitignored (that's where Jekyll puts its output)
-
CNAME file for custom domain.
-
Added the github-pages gem in the Gemfile
-
Ideally I would like to host this under a spygi.me/tech url but this is not possible with DNS since DNS works on another layer. For that I tried various combinations of the baseurl parameters in _config.yml in order to both run locally and still have CSS and other assets correctly linked in Github.io. At the end, I used a different subdomain with an APEX as explained here
- Regarding themes the easiest way to publish on Pages is by using one of the Github pages supported themes. You simply add them on the Gemfile and _config.yml and you are done.
I didn't find something that I liked so I added Travis integration following instructions from the Jasper 2 theme. The idea is by pushing to master, a Travis job is started to build the site with Rake and then push it to theThis is not required anymore since Github added full support of any Github-located theme. I just usegh-pages
branch. For more details see the related post.remote_theme: owner/name
in _config.yml
Initial inspiration by Laurent Pellegrino's blog and Marco's though neither of the the 2 worked out of the box for me: Laurent's worked locally but when pushing on Github.io, CSS and other static assets where not linked correctly (tried various combinations of base_url and relative_url but then linking of the pages would not work) and Marco used the special user repo method which I want to keep free for other stuff.
Thanks to Michael aka mmistakes for the theme.