by Ben Centra
You’ll find this post in your _posts
directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run jekyll serve
, which launches a web server and auto-regenerates your site when a file is updated.
Adding New Posts
To add new posts, simply add a file in the _posts
directory that follows the convention YYYY-MM-DD-name-of-post.ext
and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
Tags and Categories
If you list one or more categories or tags in the front matter of your post, they will be included with the post on the page as links. Clicking the link will bring you to an auto-generated archive page for the category or tag, created using the jekyll-archive gem.
Cover Images
To add a cover image to your post, set the “cover” property in the front matter with the relative URL of the image (i.e. cover: "/assets/cover_image.jpg"
).
Code Snippets
You can use highlight.js to add syntax highlight code snippets:
Use the Liquid {% highlight <language> %}
tag to add syntax highlighting to code snippets.
For instance, this template…
…will come out looking like this:
Syntax highlighting is done using highlight.js. You can change the active theme in head.html.
Images
Lightbox has been enabled for images. To create the link that’ll launch the lightbox, add data-lightbox
and data-title
attributes to an <a>
tag around your <img>
tag. The result is:
For more information, check out the Lightbox website.
Check out the Jekyll docs for more info on how to get the most out of Jekyll. File all bugs/feature requests at Jekyll’s GitHub repo. If you have questions, you can ask them on Jekyll’s dedicated Help repository.
Subscribe via RSS