Welcome to Jekyll!
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.
Blockquotes
“Blockquotes will be indented, italicized, and given a subdued light gray font. These are good for side comments not directly related to your content, or long quotations from external sources.” - Some Smart Guy
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.
Tooltips
With Tippy.js, you can add tooltips to your text with a little bit of HTML and JavaScript. First, create the tooltip trigger: <span class="tooltip" id="someId">trigger</span>
. Then in a <script>
tag at the bottom of your page, add some code to initialize the tooltip when the document is ready: window.tooltips.push(['#someId', { content: "Content" }])
See the Tippy.js docs for additional configuration that you can provide for your tooltips.
You can also use a Liquid include
to import tooltip text or HTML from an external file:
window.tooltips.push(['#someOtherId', { content: "{% include tooltips/example.html %}" }])
To modify the styles for tooltip triggers, find the .tooltip
class in _layout.scss
.
Here’s an example tooltip, and here’s another.
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