Auto-published article
This is a test article to demonstrate how to automatically publish articles using a pre-commit hook.
How it works
- Create a new markdown file in the
src/content/blogdirectory. - Ensure the markdown frontmatter does not contain a
draftfield or that thedraftfield is set tofalse. - Ensure the markdown frontmatter does not contain a
pubDatefield. - Commit the changes to the repository.
- The pre-commit hook will automatically add a
pubDatefield to the markdown frontmatter with the current date and time. - The article will be auto-published on the site when the changes are pushed to the repository.
Conclusion
This is a simple way to auto-publish articles on your site using a pre-commit hook. It can save you time and effort by automating the publishing process.
Hi, I'm Dave. I'm a software engineer based in Denver. You can follow me on Twitter or see some of my work on GitHub.