kennethreitz.org
This is the repository for the website kennethreitz.org. It is built using Flask, Tailwind CSS, and Markdown.
Features
- Fast and lightweight static site generation from Markdown files
- TailwindCSS for beautiful, responsive layouts
- Support for frontmatter metadata in YAML format
- Automatic image gallery generation
- Dark mode support
- API endpoints for headless content access
- Content search functionality
- Tag-based content organization
- Image EXIF data display
- Smart template selection based on content type
Getting Started
Prerequisites
- Python 3.12 or higher
- Node.js and npm (for Tailwind CSS)
Installation
-
Clone the repository:
git clone https://github.com/kennethreitz/kennethreitz.org.git cd kennethreitz.org -
Install Python dependencies:
uv sync -
Install Node.js dependencies:
npm install -
Build the CSS:
npm run build:css -
Run the development server:
uv run python engine.py
Directory Structure
kennethreitz.org/
├── data/ # Content directory with markdown files
├── static/ # Static assets (CSS, images, etc.)
│ ├── custom.css # Generated CSS file
│ └── tailwind-input.css # Tailwind source CSS
├── templates/ # HTML templates
├── engine.py # The main application
├── package.json # Node.js dependencies
└── tailwind.config.js # Tailwind configuration
Content Organization
All content should be placed in the data/ directory. The structure of this directory determines the URL structure of your site.
Frontmatter Metadata
You can add YAML frontmatter to your markdown files to provide metadata:
---
title: My Article Title
date: 2023-01-01
author: Your Name
tags: [python, web, development]
description: A brief description of the article
featured_image: /path/to/image.jpg
draft: false
layout: special-template
---
# My Article Title
Content goes here...
Templates
The following templates are available:
base.html: The base template with common elementsindex.html: Default template for most pagesdirectory.html: Template for directory listingspost.html: Template for individual postsphoto_browser.html: Template for image galleries
API Endpoints
The site includes several API endpoints for headless access:
/api/content/{path}: Get content and metadata for a specific path/api/search?q={query}: Search content/api/tags: Get all tags with counts
Development
CSS Development
To watch for CSS changes during development:
npm run watch:css
Debug Mode
To enable draft content and additional debugging:
DEBUG=1 uv run python engine.py
Deployment
Docker
A Dockerfile is included for easy deployment:
docker build -t kennethreitz-org .
docker run -p 8000:8000 kennethreitz-org
Fly.io
The project includes configuration for Fly.io:
fly deploy
License
This project is personal work by Kenneth Reitz.
Acknowledgments
- Built with Flask and Tailwind CSS
- Inspired by Tufte CSS design principles