Building a Jekyll Theme
Jekyll theme
Yesterday I added a theme with the automated generator. Only the main index.html
page was showing the theme. Here’s how I got the existing theme to show up on all pages.
- In C9, inside root folder add folder called
_includes
- Add 2 files
_includes/head.html
and_includes/footer.html
- Create another folder inside root called
_layouts
- New file
_layouts/post.html
-
add this to that file:
{% include head.html %} {{ content }} {% include footer.html %}
- Open main
index.html
in C9 (the one with the theme applied), copy the stuff from line 1 down to (and including)</header>
. Lines you need to copy depend on your theme. - Paste into
_includes/head.html
- Repeat step 6 but this time copy the code at the bottom. starting at and including
<footer>
down to last line. Again, varies a little per theme. - Paste into
_includes/footer.html
- Make sure your blog post specifies which layout to use. Like this:
- Forgot something… open
_includes/head.html
and modify links pointing to stylesheets and js. Example:<link rel="stylesheet" href="/stylesheets/styles.css">
- Now (still from C9) git status, add untracked files, commit, push.
- In Github do a PR to merge feature branch into master.
That’s it. :)