A Python-based template repository designed to streamline the management of technical blog posts by automating frontmatter metadata generation and environment setup.
Features
- Automates extraction and generation of metadata for blog posts using OpenAI's API.
- Supports environment initialization with dependencies including OpenAI SDK and date utilities.
- Uses TOML frontmatter format combined with Markdown for blog content.
Tech Stack
- Python 3
- OpenAI Python SDK
- python-dateutil
- tomli-w (TOML writer)
- python-dotenv for environment variable management
Getting Started
Prerequisites
- Python 3 installed
- Access to OpenAI API (for metadata generation)
Installation
Clone the repository:
git clone https://github.com/justin-napolitano/blog-template.git
cd blog-template
Initialize the environment and install dependencies:
source .env
python3 -m venv .venv
source .venv/bin/activate
pip install openai tomli-w python-dateutil
Running
- Use
fill_frontmatter.pyto generate or update blog post metadata. - Blog posts are written in Markdown with TOML frontmatter (see
index.mdas example).
Project Structure
fill_frontmatter.py: Script that generates frontmatter metadata for blog posts using OpenAI API.index.md: Sample blog post written in Markdown with TOML frontmatter.initialize.sh: Shell script to set up the Python virtual environment and install dependencies.initialize.sh.bak: Backup of the initialization script.README.md: This documentation file.
Future Work / Roadmap
- Complete and enhance the frontmatter generation logic in
fill_frontmatter.py. - Add support for batch processing of multiple blog posts.
- Integrate validation and formatting checks for frontmatter metadata.
- Expand documentation and provide usage examples.
- Consider adding CI/CD workflows for automated blog deployment.