$ touch _posts/YYYY-MM-DD-title-here.markdown
---
layout: post
title: "Your title here"
date: YYYY-MM-DD
categories:
- One here
- You can have more than one
description: "Post description here."
image: imageName.jpg
author: authorName
---
The content. This is everything underneath the last three dashes. Write your text in plain text, nothing fancy. There's an easy way to add a few things though:
{% include single-image.html fileName="06.jpg" %}
caption=""
field in your image include. For example:{% include single-image.html fileName="foo.jpg" caption="omg it's a caption" %}
Then it will look like this! :)
The reason I've implemented these includes is that they make embedding easy, they don't require you to learn any HTML conventions, and your content will always be responsive on desktop and mobile.
(There are also a couple of includes coming to lay out images two side by side, and three side by side - this is not a trivial task to make everything responsive, so give me a bit of time with it. If you need other things for including content, let me know and I'll write them!)
To write a comment that should not be displayed in the generated HTML (e.g.: a TODO), you can do as follows:
[comment]: <> (TODO: include examples of dynamic loader errors)
It's easy and intuitive, and the whole reference is here:
kramdown.gettalong.org/syntax.html
Sometimes you might want to put a post in a category that doesn't yet exist. Here's what to do:
Name this after the category you're creating, like audio.html for example. NOTE: If your category has more than one word (ie, Augmented Instruments), then name the file with a dash between each word, like this: augmented-instruments.html.
---
layout: default
title: "Audio"
description:
permalink: /category/audio/
cat-image: audio.jpg
---
{% include category.html %}
See that {% include category.html %}
bit there? It's important. Don't leave it out.
Indicate the category title.
Indicate the permalink - the page that category's posts will be displayed on. This is usually /category/your-category-title
Give the category an image - it has to be a jpg.
NOTE: There is a naming convention for this, because of boring reasons. That convention is the category title, all lower case, no spaces. For example, Augmented Instruments image would be augmentedinstruments.jpg.
Specify that file name in the cat-image field, and put it where images live: /assets/images/ For our purposes, name the category image after the title of the category so the images directory stays understandable.
Every post needs an image. This is the image that will be in the header of a post. There's white text over it, so don't make it mostly white.
The image name is in the "image: " field of your post header. Put that image in the /assets/images folder, named accordingly. The image dimensions should be about 1200 x 1000 px at the most; don't make them massive or the post will take ages to load.
Author info lives in /_data/authors.yaml. To add yourself as an author, find that file and copy+paste the fields and fill them out with your info:
jimbob:
name: Jim Bob
github: jimbobcode
twitter: jimbobtweets
email: jimbob@bela.io
profile: Some words about you. About 200 characters is enough.
author-image: jimbob.jpg
The author-image field looks for a photo in assets/images/. Make sure you add your author pic to that directory, and that the name of the file matches what you put in the author-image field. (Again, name it after yourself so the images directory doesn't get crazy.)
$ gem install jekyll
$ gem install bundler
This link has more info in case you're stuck: https://jekyllrb.com/docs/installation/
_config.yml
file. On lines 3-6 you'll see lines that are commented out. Do two things:a. Uncomment line 4
b. Comment line 6
Then save the file. The Jekyll build will now run locally, and you'll be able to view it.
_config.yml
In order to make sure you don't mistakenly commit it back with the change in place, and without you having to edit the file everytime you commit, run this:
git update-index --assume-unchanged docs/_config.yml
NOTE: if you ever want to commit actual changes to _config.yml
, then you will have to run
git update-index --no-assume-unchanged docs/_config.yml
.
This is super easy. Two parts: first, test that it looks the way you want it to, and second, push to the master.
After you've written your post, go to the command line. Go to your cloned Github repo and cd into the docs
folder. (I'm assuming it's in ~/Github
here for the sake of example.)
$ cd ~/Github/bela_newBlog/docs
$ bundle exec jekyll serve
Now, go to http://localhost:4000 and check that it looks okay.
Push everything to the master branch, and Github pages will automagically update, recompile, and serve the site. MAGIC!