# Stopplidelsen.no - Content Repository

This repository contains the content and custom styling for [stopplidelsen.no](https://stopplidelsen.no), a Norwegian organization focused on medical cannabis awareness and information.

## Project Structure

```
stopplidelsen-innhold/
├── app/           # Core framework (router, templates, vendor libraries)
├── content/       # All public content (document root)
│   ├── artikler/  # Articles
│   ├── brosjyrer/ # Brochures
│   ├── nyheter/   # News
│   ├── faq/       # Frequently asked questions
│   └── kontakt/   # Contact information
└── custom/        # Site-specific customizations
    ├── templates/ # Custom template overrides
    ├── styles/    # Custom CSS
    ├── languages/ # Translation files (no.ini, en.ini)
    ├── fonts/     # Web fonts
    └── assets/    # Images and other assets
```

## Technology Stack

- **Backend**: PHP 8.3+ (Apache module)
- **Content Format**: Markdown (via Parsedown library)
- **Frontend**: Modern HTML5/CSS3
- **Infrastructure**: podman (Apache container)
- **Languages**: Norwegian (default) and English

## Architecture Overview

### `/app/` - Core Framework

A minimal, file-based CMS framework providing:
- Request routing (`router.php`)
- Static asset serving (`static.php`)
- Default templates and configuration
- Markdown parser (Parsedown vendor library)

See [app/README.md](app/README.md) for framework documentation.

### `/content/` - Public Content

The document root containing all public-facing content. Each section is organized hierarchically with:
- `metadata.ini` - Configuration and metadata
- `article.md` or `page.md` - Content in Markdown
- Images, PDFs, and other media files

### `/custom/` - Site Customizations

Site-specific overrides including:
- **Templates**: Custom PHP templates that override defaults from `/app/default/`
- **Styles**: Custom CSS styling
- **Translations**: Language files for Norwegian and English
- **Fonts & Assets**: Web fonts and images

## Local Development

### Using podman (Recommended)

```bash
# Start the development server
podman compose up

# Access the site at http://localhost:4040
```

### Manual Setup

Requirements:
- PHP 8.3+
- Apache with mod_rewrite enabled
- Configure document root to `content/`

## Server Deployment Structure

The production server uses symlinks to separate the app code from content, allowing two independent git repositories:

```
/home/rubensol/dev.stopplidelsen.no/
├── folderweb/           # App repository
│   ├── app/
└── innhold/             # Content repository
    ├── content/         # Document root
    ├── custom/
    └── app/             # Symlink → ../folderweb/app/
```

### Required Symlinks

**In `/innhold/` directory:**
```bash
cd /home/rubensol/dev.stopplidelsen.no/innhold/
ln -s ../folderweb/app app
```

**In `/folderweb/` directory:**
```bash
cd /home/rubensol/dev.stopplidelsen.no/folderweb/
ln -s ../innhold/custom custom
```

### Web Server Configuration

- **Document Root:** `content/`
- The `.htaccess` file in `content/` routes all requests through `index.php`
- Static `/app/` requests are handled by `app/static.php`

## Content Management

### Creating New Content

1. Create a new directory in the appropriate section (e.g., `content/artikler/my-article/`)
2. Add a `metadata.ini` file with title, slug, and other metadata
3. Create content in `article.md` (or `article.no.md` and `article.en.md` for translations)
4. Optionally add `cover.jpg` for thumbnail images

### Multilingual Content

The site supports Norwegian and English:
- URLs use language prefixes: `/no/artikler/...` or `/en/articles/...`
- Content files can be language-specific: `article.no.md`, `article.en.md`
- Slugs are translated via `metadata.ini` configuration
- Translations stored in `custom/languages/no.ini` and `en.ini`

## Key Features

- **File-based CMS**: No database required
- **Markdown support**: Write content in Markdown with automatic HTML conversion
- **Multilingual**: Norwegian and English with URL-based language switching
- **SEO-friendly URLs**: Clean, translatable slugs
- **Multiple template layouts**: List, grid, card grid, FAQ views
- **Media support**: Cover images, PDFs, downloadable resources
- **Performance tracking**: Page generation timing displayed
