# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Static website for DO CLOUD (Internet Cloud Services SL) built with **docmd** (@mgks/docmd), a Markdown-to-HTML static site generator. The site is automatically deployed via Forgejo Actions CI/CD to a Docker container behind Traefik reverse proxy.

## Build & Deploy

```bash
# Install dependencies
npm install

# Build site locally (outputs to ./site/)
npm run build

# Deploy happens automatically on push to main branch
git push origin main
```

The CI/CD pipeline (`.forgejo/workflows/deploy.yml`) builds a Docker image and deploys to `docloud.ics53.vpn9.com.es` with Traefik labels for SSL.

## Architecture

```
Push to Forgejo → Forgejo Runner → Docker build → Traefik serves with SSL
```

**Key files:**
- `docmd.config.js` - Site configuration (title, navigation, theme, SEO)
- `nginx.conf` - Custom nginx config with caching and security headers
- `Dockerfile` - Multi-stage build: node:20-alpine builds, nginx:alpine serves
- `assets/custom.css` - Brand styling overrides
- `robots.txt` / `sitemap.xml` - SEO files (copied post-build)

**Content files (Markdown):**
- `index.md` - Homepage
- `quienes-somos.md`, `contacto.md` - Main pages
- `aviso-legal.md`, `politica-*.md` - Legal pages

## Brand Guidelines

From `branding_pack/brand-guide.md`:
- **Primary blue**: #0A6CFF
- **Turquoise**: #1FD1C3
- **Dark blue**: #0B1E3B
- **Light gray**: #F2F4F7
- **Font**: Inter (Google Fonts)

Logo files in `branding_pack/` (SVG preferred for web).

## Performance Notes

The Dockerfile includes post-build optimizations:
- Removes mermaid.js (~816KB) since diagrams aren't used
- nginx config sets 1-year cache for static assets
- Gzip compression enabled

## Navigation Links

Use absolute paths with leading `/` for internal links to work from any page:
```markdown
[Link Text](/page-name/)
```

docmd generates directory structure (`/page/index.html`), not flat HTML files.

## Server Administration

### Documentation

| Document | Path | Description |
|----------|------|-------------|
| Guia DOCMD | `/root/guia-docmd.md` | Manual completo de administracion de sitios |
| Instrucciones | `/root/instrucciones.md` | Especificaciones tecnicas del servidor |
| Brand Guide | `branding_pack/brand-guide.md` | Guia de identidad visual DO CLOUD |

### Server Paths

| Component | Path |
|-----------|------|
| Sites directory | `/opt/sites/` |
| Traefik config | `/opt/traefik/` |
| Traefik certificates | `/opt/traefik/acme.json` |
| Site provisioning script | `/opt/scripts/docmd-site.sh` |
| Forgejo Runner config | `/opt/config.yaml` |
| Runner service | `systemctl status forgejo-runner` |

### Common Admin Commands

```bash
# Ver contenedores activos
docker ps

# Ver logs de un sitio
docker logs <site-name>

# Reiniciar runner CI/CD
systemctl restart forgejo-runner

# Crear nuevo sitio
/opt/scripts/docmd-site.sh --owner <user> --site <domain>

# Forzar rebuild de un sitio
cd /opt/sites/<domain> && git commit --allow-empty -m "rebuild" && git push

# Ver certificados SSL
cat /opt/traefik/acme.json | jq '.myresolver.Certificates[].domain'
```

### Infrastructure

- **Server**: ics53.vpn9.com.es (164.132.1.53)
- **Wildcard DNS**: *.ics53.vpn9.com.es → 164.132.1.53
- **Forgejo**: https://forgejo.dock698.vpn9.com.es
- **Traefik**: Reverse proxy with automatic Let's Encrypt SSL
