Blog-Update-Fetching-Script
Blog Update Fetching Script
Github repo: My repo
Blog Update Fetching Script
Introduction
This is an automation script I implemented in the Hexo blog update to automatically fetch blog updates, compare them with previous update statuses, and allow users to manually determine the update status of unfinished and newly added blogs, thus obtaining the new blog update status.
Preliminaries
Due to the strict formatting requirements of the automation script for the text, please make sure to complete the following modifications before use!
Modify to your blog directory
In main.sh
, change the directory into your own directory:
1 |
|
Create a new directory
1 |
|
Initialize prev.txt
You need to initialize prev.txt
for your own blog!
For this document, please maintain the following format: Each line should include a prefix status emoji and the title name. The prefix status emojis include ✅ and ❌, indicating the completion status of the blog.
An example text is as follows:
1 |
|
Please ensure that your output structure maintains alphabetical order. You can use the following command line to achieve this:
1 |
|
You only need to initialize it once! The scripts will update it later.
Usage
For Hexo Blog users, the directory which stores your Blog posts may be like as follows:
- Several
.md
files - Several directories which has the same name with
.md
files
The main.sh
will automatically get all file names using the grep
command:
1 |
|
grep -v ".*\.sh"
is because I add several.sh
files into it. You can modify it with your own needs.
Then, the file will compare the new status with the previous status stored in the prev.txt
. Then the file will ask users to manually determine the update status of unfinished and newly added blogs.
The output log looks as follows:
1 |
|
Finally, the scripts will update prev.txt
and generate a new blog status named 20250330_200559.txt
and you can see the updated status there!
Demo:
1 |
|
Enjoy Coding
Discussion
Just for fun, and just for hexo
users.