Frictionless Blogging: How I made blogging easier
The Challenge: Time-Consuming Blogging with MDX and NextJS
As a blogger, you know that creating high-quality content is essential to your success. However, the process of creating blog posts using MDX and NextJS can be tedious and time-consuming, taking away from the time and focus needed for writing. Specially when you have to manually create a new blog post, navigate to the blog folder, and then open the blog post in VS Code and then put in all the boilerplate for the Article props.
The Solution: Automation and Simplification
To address this challenge, one I turned to automation and simplification, using an alias and a cool Visual Studio (VS) snippet to make the process of blogging more efficient and streamlined.
How It Works: Creating a Terminal Alias
I started by creating a terminal alias that allowed me to quickly open their blog folder without the hassle of manually navigating to it. Here's what the alias looked like, using VS code as my editor of choice:
alias blog="code ~/Path/to/blog/code"
Now I can simply type blog
in my terminal and it will open up my blog folder in VS Code.
How It Works: Using a VS Snippet for Quick Blog Post Creation
To get over the boilerplate, I also created a VS snippet that to create a new blog post quickly and easily. The snippet included code that automatically filled in the author and date fields of the blog post, saving me even more time. Here's what the code for the VS snippet looked like:
{
"Blog": {
"prefix": "mdx-article",
"body": [
"import { ArticleLayout } from '@/components/ArticleLayout'",
"",
"export const meta = {",
"\tauthor: 'Kinyobi',",
"\tdate: '$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE',",
"\ttitle: '$1',",
"\tdescription: '$2',",
"}",
"",
"export default (props) => <ArticleLayout meta={meta} {...props} />\n\n$5"
],
"description": "New article boilerplate"
}
}
Now I simply type mdx-article
in my VS Code editor and it will create a new blog post with the boilerplate already filled in.
Conclusion: Improved Productivity and Efficiency
By creating a terminal alias and a cool VS snippet, I was able to simplify the my blogging proccess and setup, making it easier and more enjoyable. I am able to focus more on writing and less on the logistics of creating blog posts. If you're haev a smilar setup and struggling with similar issues, consider implementing these solutions to improve your workflow and boost your productivity. And a special thanks to ChatGPT for helping to make this blog post possible.