Whenever I want to add content to my website, I have to do a few things:
- Open terminal, navigate to the website directory, and start the Hugo server
- Open the website directory in Finder
- Open the markdown file for my post with Typora
Since this takes a long time, I wanted to automate the process so that I’d only have to type in a simple command into Alfred. I already failed at creating a functional Discord bot earlier today, so I thought I’d do this really quick so that I can say I accomplished something.
I’m using Alfred 4 for this, which has a convenient workflow creator. I started with a blank template and added my first input, which was typing:
That lead to two actions; the first is opening the folder in Finder. I typed in the directory for the folder with all my website content in it, and it worked.
The next action is opening the folder with all my content in Terminal and running a command to start the Hugo server:
cd [path to my folder here] hugo server -D
And that’s it! Here are the nodes I used (The middle right one just opens Terminal without starting the Hugo server):
From there on, I just click to open a markdown file in Typora or I open Visual Studio Code to edit the actual website.
Obigatory ending with a (somewhat) relevant xkcd: