Last active
December 5, 2025 21:03
-
-
Save cbgoodman/81fc09b1708c0e438f5bcad8b5ea1d6a to your computer and use it in GitHub Desktop.
Raycast script to create a new Quarto blog post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Required parameters: | |
| # @raycast.schemaVersion 1 | |
| # @raycast.title New Blog Post | |
| # @raycast.mode silent | |
| # Optional parameters: | |
| # @raycast.argument1 { "name": "title", "placeholder": "Title", "type": "text", "required": true } | |
| # @raycast.icon ✉️ | |
| # Documentation: | |
| # @raycast.description Create New Quarto Blog post | |
| # @raycast.author Chris Goodman | |
| # @raycast.authorURL https://hello.cgoodman.com | |
| # Check if folder name is provided | |
| if [ -z "$1" ]; then | |
| echo "Error: No post title provided" | |
| exit 1 | |
| fi | |
| # Get the current date in ISO-8601 format | |
| yaml_date=$(date +%Y-%m-%d) | |
| # Format title | |
| lower_string=$(echo "$1" | awk '{ | |
| tolower($0); | |
| gsub(/[^a-zA-Z0-9\-]/, " ", $0); | |
| print $0 | |
| }') | |
| slug=$(echo "$lower_string" | awk '{for (i=1; i<5; ++i) str=sprintf("%s-%s",str,$i)}END{print str}') | |
| # Build the full path; format to your filesystem | |
| full_path="$HOME/website/blog/$yaml_date$slug" | |
| # Create the directory | |
| mkdir -p "$full_path" | |
| # Create index.qmd with template | |
| cat > "$full_path/index.qmd" << EOF | |
| --- | |
| title: "$1" | |
| date: "$yaml_date" | |
| description: "DESCRIPTION HERE (150-160 characters)" | |
| image: "img/BLAH.png" | |
| twitter-card: | |
| image: "img/BLAH.png" | |
| open-graph: | |
| image: "img/BLAH.png" | |
| categories: | |
| - SOMETHING | |
| format: | |
| html: | |
| fig-cap-location: margin | |
| code-copy: true | |
| --- | |
| CONTENT HERE | |
| EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment