# onepager Project Instructions

## Project Overview

Mono-repo for 57+ vanity domain onepager sites. Single Caddy container with bash template system and host-based routing. Most domains are creative AI/KI wordplay (kAInco, kIlemma, orAKIl, etc.).

**Deploy:** Push to main -> Dokploy auto-deploys. All domains must be configured in Dokploy.

## Architecture

```
sites/<domain>/           # One folder per domain
  site.yaml               # Config: domain, template, vars
  index.html              # Content (rendered or hand-crafted for custom)
  assets/                 # Optional images, fonts
templates/                # 6 HTML templates + base.html
  base.html               # Shared skeleton (CSS includes, meta tags)
  person-dark.html        # Professional profile, dark theme
  person-light.html       # Professional profile, light/cream theme
  product-dark.html       # Product/service landing, dark
  editorial.html          # Long-form manifesto/editorial
  fun.html                # Playful/personal pages
  minimal.html            # Bare-bones single section
shared/
  css/                    # variables.css, responsive.css, animations.css, noise.css
  fonts.html              # Google Fonts includes
  impressum.js            # Shared impressum overlay
build/                    # Generated output (gitignored)
Caddyfile                 # Generated by generate-caddyfile.sh (committed)
```

### Build Pipeline

1. `generate-caddyfile.sh` reads all `sites/*/site.yaml` -> generates Caddyfile with host matchers
2. `build.sh` orchestrates: generates Caddyfile, renders all sites, copies shared assets to `build/`
3. `render.sh` takes `site.yaml` + template -> outputs rendered HTML (bash/yq/awk templating)
4. Docker: Alpine builder runs `build.sh`, then Caddy serves from `/srv/`

### Template System

Templates use `{{placeholder}}` markers. `render.sh` reads vars from `site.yaml` and substitutes. Templates define CSS between `{{template_css_start}}`/`{{template_css_end}}` and body between `{{template_body_start}}`/`{{template_body_end}}`. Base template assembles shared CSS + template CSS + body.

Available vars: `title`, `description`, `lang`, `name`, `role`, `initials`, `tagline`, `accent`, `accent_light`, `font_primary`, `font_secondary`, `emoji`, `cta_text`, `cta_href`, `tags_html`, `sections_html`, `content_html`, `domain`, `year`.

### Custom Sites

Sites with `template: custom` skip rendering entirely -- their `index.html` is copied as-is. Many sites use custom for complex interactive content (e.g., orakil.de oracle, ichbinotto.de agent profile).

## Code Style & Conventions

- **Shell scripts**: bash, `set -euo pipefail`, use yq for YAML parsing
- **HTML/CSS**: Inline styles in templates. Shared CSS via variables.css. Dark themes predominant.
- **Commit messages**: `feat:` for new sites, `fix:` for corrections, `refactor:` for restructuring
- **Site naming**: domain name = folder name under `sites/`
- **Language**: Default `de` (German). Sites are primarily German-language.

## Adding a New Site

```bash
# Templated
./add-site.sh example.de --template person-dark --name "Max Mustermann"

# Custom
./add-site.sh example.de --template custom
# Then edit sites/example.de/index.html
```

After adding: build locally with `./build.sh` to verify, commit, push.

## Deploy Trigger

A `.deploy-trigger` file exists -- changing its content forces Dokploy rebuild even without code changes.

## Git Strategy

- **main** = production, auto-deploys via Dokploy
- Feature branches for multi-site changes or infrastructure work
- Direct commits to main OK for single-site additions/fixes (this is a content repo)
- Gitea repo: m/onepager
