My new publishing workflow
Published on under the Coding category.
The intended audience for this post is programmers.
My blog post publishing process is convoluted. To publish a blog post, I have to:
- Go to GitHub, where my blog is hosted.
- Navigate to my repository.
- Go into the posts folder.
- Wait for the page to load properly, since there are so many posts.
- Click
Add file
. - Copy-paste the metadata from another blog post so I can set my post title, categories, and other pieces of information (and it can take a few seconds to find the right post from which I want to copy, since not all posts have the same metadata).
- Copy-paste my post content from the text editor I use, Typora, into the file on GitHub.
- Create the file.
My static site generator then turns the file into a web page.
If I want to include an image in my post, I also have to:
- Find, then click to go to, the assets folder in GitHub where all my images are stored.
- Click to upload an image.
- Upload an image.
This is a lot of steps. And I have been following them for at least six months.
This week, after talking with some fellow website makers, I had an idea: I could make a tool to simplify this.
I did some research earlier today and found that there is a link structure you can use to take content and auto-paste it into GitHub. Herein lay an opportunity: I could make a form where I can type in all of the information I need for a post (i.e. title, post content), and auto-fill others (i.e. publication date). This form could have a button that structures all the information in the way required for my site to understand it, then open GitHub with the final post ready to publish.
The URL structure is:
`https://github.com/capjamesg/jamesg.blog/new/main/_posts/?filename=${filename}.md&value={file_contents}`;
This afternoon, I made a web page that meets these requirements, allowing me to skip all of the steps above and format a post in a form I made. I can type in the information I need to publish a blog post, click a few buttons, and my blog post will be in GitHub. The form automatically adds the date and time a post was published, so I no longer have to add that to my posts. It also lists several categories that I use often from which I can choose, eliminating the risk I use the wrong name for a category (something I do often!).
My form URL-encodes the file contents so the contents show up properly in GitHub when the form submits.
The form doesn’t actually create anything on my site: it creates the page and redirects me to GitHub, where I can click submit to save the file.
Here is the form on my website, the final result of the project:
If you are interested in how this page works, the page is public! View the blog post create page.
I had a lot of fun making this tool. I had a problem – a slow, convoluted, verging-on-frustrating publishing process – and was able to make something simpler. I now wonder if I should add boxes for common things I need when formatting posts before publishing, like the HTML tags I use for code snippets. The opportunities are exciting! My mind is also thinking about other publishing tools I could make for use in my work as a technical writer.
This is my first post published using the new tool! I’m excited!