Static pages
oldp.apps.pages serves markdown files as static pages at /pages/<slug>/
(imprint, privacy policy, terms, …).
Location: files live in
MARKDOWN_PAGES_DIR, where each<slug>.mdbecomes a page.The default is
oldp/apps/pages/content/.Themes can point the setting elsewhere.
Deployments can override it with the
DJANGO_MARKDOWN_PAGES_DIRenv var, so the texts can live in a separate repository and be mounted into the container.
No file: if no file exists for a slug, the view falls back to a database flatpage at
/<slug>/, then to 404.Markdown: rendered with python-markdown and the extensions
meta,extra(tables, fenced code,attr_list,md_in_html, …),sane_lists,smarty,tocandcodehilite(see Code blocks).Title: an optional
title:meta header sets the page title. Otherwise the first# H1is used, then the slug.Caching: parsed pages are cached per process and re-parsed when the file’s mtime changes, so an edited file shows up without a restart.
Code blocks
Fenced code blocks with a language are syntax-highlighted on the server by
Pygments (python-markdown codehilite). The page
ships no JavaScript and makes no third-party requests:
```bash
curl "{{ urls.api }}cases/?limit=10"
```
Languages: any Pygments lexer name, e.g.
bash,json,pythonorhttp.No language: a block without one stays plain. There is no guessing.
Styling: token colours are Pygments’ light
defaultstyle (scss/oldp/_pygments.scss). The box (margin, background, sideways scrolling of long lines) is inscss/oldp/_pages.scss.Placeholders: they work inside code blocks too (see below).
Settings values in pages
Some pages mention values that are configured in Django settings, such as rate limits or the MCP endpoint URL. Hard-coding them means the page goes stale whenever a setting changes. Write a placeholder instead; it is filled at request time:
Without an account you can make {{ limits.anon.count }} requests per
{{ limits.anon.period }}; with an account {{ limits.user.count }} per
{{ limits.user.period }}.
MCP server: `{{ urls.mcp }}`
renders (English, default rate limits, SITE_URL=https://de.openlegaldata.io) as:
Without an account you can make 100 requests per day; with an account 5,000 per hour. MCP server:
https://de.openlegaldata.io/mcp
Available placeholders
Placeholder |
Value |
Source |
|---|---|---|
|
e.g. |
|
|
e.g. |
|
|
e.g. |
|
|
e.g. |
|
|
|
|
|
API root, ReDoc, Swagger UI, OpenAPI JSON |
|
|
|
|
|
API token page, sign-up, profile |
|
|
installed oldp version |
|
How the values are formatted:
Language: values are formatted in the page’s language, set with an optional
language:header (e.g.language: denext totitle:). Without the header they follow the visitor’s active language. A German page should set it, or an English-speaking visitor sees5,000 pro hour..countis localized with a thousands separator:5,000in English,5.000in German..periodis the translated singular unit:hourin English,Stundein German.
Rules
Lookups only: placeholders are plain lookups in the table above. This is not the Django template engine: no tags, filters or expressions.
Escaping: values are HTML-escaped. A placeholder also works inside code spans, highlighted code blocks and the
title:header.Before parsing, each placeholder is swapped for an alphanumeric sentinel (
OLDPVAR…Z), so Pygments cannot split it into tokens. After parsing the sentinel is replaced with the value.
Unknown keys: an unknown key is left on the page as written and logged as a warning (
oldp.apps.pages.variables), so a typo is visible rather than blank. A deployment smoke check can grep the rendered page for{{.Not the first line: do not start a file with a line like
Key: {{ … }}. Themetaextension would read it as a header field. Start with a title header or a heading.Other pages: pages without placeholders are served exactly as before.
New placeholders: add them to
page_variables()inoldp/apps/pages/variables.pyand to this table.