Hugo Schedule posts
How to schedule posts
This step is how to schedule blog posts for the future, and to get them to appear on a given day. It lets you create content, and spread it out over a period, instead of having to push the new changes on a given day.
The following steps only need doing once
- Open c:\hugo\sites\example.com.github\workflows
- Copy the .yml file, and give it a name of “schedule.yml”
- Edit the schedule.yml file
- Change the “name” property to add “Scheduled”
- Remove the “on” section (lines 3 to 10)
- Add the following
on:
schedule:- cron: “0 6 * * *”
- Remove the following line:
if: github.event_name == ‘push’ || (github.event_name == ‘pull_request’ && github.event.action != ‘closed’) - Save
- Commit and push
- Hope. Note, will not be at exact minute.
The following steps need doing for each post
- Create a new page as normal
- Open the new page in your editor of choice
- In the section at the top of the page, there should be a “date” property.
- Change the value of the corresponding date to be the date you want the content to be visible. It is in the yyyy-mm-dd format.
- Add whatever content you want to the post.
- Run the command “hugo server -DF” The “F” flag will include future changes
- Make sure you are happy with the changes
- Push and commit you changes.
For more information, check out: