synops/maskinrommet/src/templates/magasin/article.html
vegard 4b9f520eab Tera-templates: innebygde temaer for publisering (oppgave 14.1)
Implementerer publiseringsmotoren med fire innebygde temaer:
- Avis: multi-kolonne, informasjonstung, hero+sidebar+rutenett
- Magasin: store bilder, luft, editorial, cards-layout
- Blogg: enkel, én kolonne, kronologisk liste
- Tidsskrift: akademisk, tekstdrevet, nummerert innholdsfortegnelse

Hvert tema har artikkelmal + forside-mal som Tera-templates (Jinja2-like).
CSS-variabler for theme_config-overstyring fra publishing-traiten —
fungerer meningsfullt med bare "theme": "magasin" (null konfigurasjon).

Teknisk:
- publishing.rs: Tera engine, render-funksjoner, DB-spørringer, HTTP-handlers
- Templates innebygd via include_str! (kompilert inn i binæren)
- Ruter: GET /pub/{slug} (forside), /pub/{slug}/{id} (artikkel),
  /pub/{slug}/preview/{theme} (forhåndsvisning med testdata)
- 6 enhetstester for CSS-variabler, rendering og tema-fallback

Ref: docs/concepts/publisering.md § "Temaer"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 00:41:54 +00:00

59 lines
1.4 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ article.title }} — {{ collection_title }}{% endblock %}
{% block extra_css %}
.mag-article {
max-width: var(--layout-max-width);
margin: 0 auto;
padding: 0 1rem;
}
.mag-article__header {
text-align: center;
padding: 3rem 0 2rem;
max-width: 720px;
margin: 0 auto;
}
.mag-article__title {
font-family: var(--font-heading);
font-size: 3rem;
line-height: 1.1;
color: var(--color-primary);
margin-bottom: 0.75rem;
}
.mag-article__meta {
color: var(--color-muted);
font-size: 0.9rem;
}
.mag-article__content {
max-width: 680px;
margin: 0 auto;
font-size: 1.1rem;
line-height: 1.8;
padding-bottom: 3rem;
}
.mag-article__content p { margin-bottom: 1.25em; }
.mag-article__back {
display: inline-block;
margin-top: 2rem;
font-size: 0.9rem;
}
@media (max-width: 768px) {
.mag-article__title { font-size: 2rem; }
.mag-article__header { padding: 2rem 0 1.5rem; }
}
{% endblock %}
{% block content %}
<article class="mag-article">
<header class="mag-article__header">
<h1 class="mag-article__title">{{ article.title }}</h1>
<div class="mag-article__meta">Publisert {{ article.published_at_short }}</div>
</header>
<div class="mag-article__content">
{{ article.content | safe }}
<a class="mag-article__back" href="{{ base_url }}">&larr; Tilbake</a>
</div>
</article>
{% endblock %}