Jekyll
Creating a TIL from the command line
Just a bash script to Jekyll Compose a TIL and open it in VSCodium.
#!/usr/bin/env bash
SITE_DIR="$HOME/<Site Directory...>" # Replace with the path to your site
# Take the first command line argument as the title
TITLE="$1"
# Change directory to the site directory
cd "$SITE_DIR" || exit
# Compose a new TIL
NEW_FILE_PATH=$(bundle exec jekyll compose "$TITLE" --collection='til' | grep -o '_til/.*')
# Open the newly created file
code "$SITE_DIR/$NEW_FILE_PATH"
# Start server
bundle exec jekyll s --livereload
Of course, I added it to a local bin directory in my PATH, so I can run the til '<Title...>'
command from any location.
Integrating Jekyll Compose with my TIL Collection
Since I have a custom layout for the TIL collection, I added default frontmatter for Jekyll Compose for the collection:
jekyll_compose:
default_front_matter:
til:
layout: "til"
This allows me to use the following command to create a TIL with the default frontmatter.
bundle exec jekyll compose "Some TIL title here" --collection "til"
Adding a Today I Learned (TIL) section to my website
In _config.yml
, I added a new collection specifically for TIL posts:
collections:
til:
output: true
permalink: /til/:title/
Getting Started with Jekyll on macOS
So you want to set up a sleek new Jekyll site, but you’re staring at your terminal wondering why Ruby, Bundler, and a bunch of configuration files are involved. Fear not, intrepid site-builder, because I’ve got your back. Let’s walk through how to set up Ruby using chruby
and Homebrew, install Bundler, and get Jekyll running smoothly on macOS.
Why Ruby, Bundler, and chruby?
Before diving in, here’s the TL;DR on why you need these tools:
More ...