Creating an 11ty blog post using Raycast

Speeding up my blog workflow

Mar 26, 2024 • • 🍿 2 min. read in eleventy

I've been loving using Raycast recently, and I wanted to see if I could speed up blog post file creation, given I used to create all posts initially using an Alfred workflow.

Raycast has the ability to trigger bash scripts on the local file system, so I figured I could use this to create a new post file.

A quick Google gave me the useful post and bash script example from Sam Warnick.

Combining that with passing in bash params (raycast docs)
and I ended up with the following:


# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title blog
# @raycast.mode compact

# Optional parameters:
# @raycast.icon 🤖

# Documentation:
# @raycast.description Create blog post
# alpower
# @raycast.authorURL
# @raycast.argument1 { "type": "text", "placeholder": "title" }

today=$(date +%Y-%m-%d)
publish=$(date -v +1H +"%Y-%m-%d %H:00")
filename="${1// /-}"

title: $title
date: $today
permalink: blog/$filename/index.html
written on $publish

printf -- "$template" >> "$path"

open -a "Visual Studio Code" "$path"

Some notes:

  • The @raycast.title blog is whatever command you want to trigger the script with.
  • The filename variable takes the query param title and hyphenates.
  • The path variable is whereever you store your blog entries on your local file system.
  • The publish variable is not needed - just added incase ever want to use today's date and time.
  • permalink is because I want to start ordering my markdown with the date to find files faster, but not have the dates show in the URLs.
  • I added the date in as YAML frontmatter as I use it in my listing code - this is optional if you include it in your filename.
  • The final open command can be any application you want on your Mac that edits text files - I also tried this with iA Writer and it worked fine.


Trigger Raycast. Type blog and tab to the title field. Enter a title like my test post gives you a file with a filename of

/TODO Still needed

It's not perfect by any means - I still need to solve escaping single quotes in the title and also lowercasing the file name, but it's a good start to get me blogging faster!

Posted in eleventy