Create new homepage template displaying live download counters for Requests and Cerifi packages with animated statistics and personal introduction content.
kennethreitz.org
This is the repository for the website kennethreitz.org. It is built using FastAPI, 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.8 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:
pip install -r requirements.txt -
Install Node.js dependencies:
npm install -
Build the CSS:
npm run build:css -
Run the development server:
python tuftedoc.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
├── tuftedoc.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 python tuftedoc.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 FastAPI and Tailwind CSS
- Inspired by Tufte CSS design principles