Blogging Tools I Use#
- hugo: Blog website generation tool
 - vscode: File editing tool
 - git: Tool for uploading files to Github
 - Shell scripting: Write one-click command code
 
When using vscode and git, every time I update my blog, I need to enter a series of repetitive code in the terminal. The following content may be helpful for users who are troubled by this.
Inconveniences of Using vscode and git#
- Every time a new file is created, I need to enter 
hugo new posts/newfilename.mdin vscode terminal to create a new file. - Every time a file is uploaded, I need to enter at least 5 commands in the vscode terminal... 
hugo,cd public,git add .... - If I have to enter 5 commands every time I make a change and upload, it becomes unpleasant and tiresome.
 
So, is there a better solution?
The answer is yes.
Solutions#
One-click File Creation#
- First, create a 
new.shfile in the top-level folder of the blog. - Enter the following content in the file:
 
time=$(date "+%Y-%m-%d")
echo $time
hugo new posts/$time.md
exit
- When creating a new file, enter 
newin the terminal, pressTab, and then pressEnter. This will create a new file in the posts/ directory with the current date as the file name. 
One-click File Upload#
- First, create a 
hugo.shfile in the top-level folder of the blog. - Enter the following content in the file:
 
hugo
time=$(date "+%Y-%m-%d %H:%M:%S")
echo $time
cd public
git add .
git commit -m "Automated build script execution 🎓$time"
git push
exit
- When updating (uploading) a file, enter 
hugoin the terminal, pressTab, and then pressEnter. This will automatically upload the updated blog to Github with the current date as the update message. 
If you have any questions, please contact me via email.