{{/* Shared partials, parsed into every page. Not named with a leading underscore: go:embed silently skips such files. */}} {{/* mapa-linked: a backlink or mention group. Keys: Items ([]Linked), Heading, Empty, Target (the page's id, for "Link it"; 0 for none). */}} {{define "mapa-linked"}}

{{.Heading}}

{{if .Items}}{{$target := .Target}} {{else}}

{{.Empty}}

{{end}}
{{end}} {{/* mapa-editor: the scriptless editor. Keys: Body, Error. */}} {{define "mapa-editor"}}
Markdown. Link a page with [[Its title]]; a date like [[2026-11-12]] opens your own daily note. {{if .Error}}{{.Error}}{{end}}
{{with .Upload}}
Add an image The image goes at the end of the page, and Save keeps it. An image copied from another page shows as not available here: upload it instead.
{{end}} {{end}} {{/* The alt field comes before the file, so it is read first: a file refused for its size still leaves what was typed (Fable L5). */}} {{/* mapa-page-images: "Images on this page" (images §3.3, §4.4), each with Open and Remove. Keys: Images ([]ListedImage), Back (where Remove returns). */}} {{define "mapa-page-images"}}{{if .Images}}

Images on this page

Removing an image takes it out of Mapa everywhere, History included. A browser that has already shown it may keep its own copy for up to an hour.

{{end}}{{end}} {{/* mapa-unsaved: the draft bar (§5, level-up §6.8). The page shows the person's unsaved text, or with Saved (?saved=1) the committed text. Keys: Draft (DraftView), Save, Discard (form actions), Href (the page, for "Show the saved version"; "" where nothing is saved yet), Saved. */}} {{define "mapa-unsaved"}}

Unsaved changes from . {{if .Saved}}You're seeing the saved version.{{else}}You're seeing your unsaved version.{{end}}

{{with .Href}}{{if $.Saved}}Show your unsaved version{{else}}Show the saved version{{end}}{{end}}
{{end}} {{/* mapa-island: the editor's data (level-up §6.8), JSON written by encoding/json, which escapes <, >, & and U+2028/9, and the editor's bundle, a module, so deferred (§6.2). The editor mounts on the
that follows. */}} {{define "mapa-island"}}{{with .}} {{end}}{{end}} {{/* mapa-editing: "Ana is editing", team pages only (§5). */}} {{define "mapa-editing"}}{{with .}}

{{range $i, $who := .}}{{if $i}}, {{end}}{{$who}}{{end}} {{if eq (len .) 1}}is{{else}}are{{end}} editing this page.

{{end}}{{end}} {{/* mapa-doc-head: the page's kicker and its large title (level-up §4.1). The kicker says what kind of page this is and who can open it; Edit as Markdown opens the textarea, the floor without script (§6.10). Keys: Page (PageView), Last (*LastEdit or nil), Edit (href, or "" on the editor itself), Day (*dayPill, daily notes), Rename (the rename POST, on a team page the editor mounts on; "" elsewhere). With Rename, the editor's script makes the title's text editable in place (editor/title.mjs, build note 78); without script it is the plain heading it always was. */}} {{define "mapa-doc-head"}}{{$page := .Page}}
{{- if eq $page.Kind "page"}}{{icon "users"}}Team page {{- else if eq $page.Kind "daily"}}{{icon "lock"}}Your note. Only you can open it. {{- else}}{{icon "lock"}}Scratch. Only you can open it.{{end}} {{- with .Last}}Edited by {{.Who}} {{editedWhen .At}}{{end}} {{- with $page.From}}{{.}}{{end}} {{- with $page.Aliases}}Also called {{range $i, $a := .}}{{if $i}}, {{end}}{{$a.Title}}{{end}}{{end}} {{- with .Edit}}{{icon "pencil"}}Edit as Markdown{{end}} {{- with .Day}}{{template "mapa-day-pill" .}}{{end}}
{{with .Look}}{{template "mapa-look-row" dict "Href" . "Page" $page "Banner" $.Banner}}{{end}} {{if .Rename}}

{{with $page.Look}}{{pageIcon . ""}}{{end}}{{$page.Label}}

{{- else}}

{{with $page.Look}}{{pageIcon . ""}}{{end}}{{if eq $page.Kind "daily"}}{{dayTitle $page.Date}}{{dayYear $page.Date}}{{else}}{{$page.Label}}{{end}}

{{end}}
{{end}} {{/* mapa-banner: a team page's band (columns and icons spec §3.2): a fixed height, the picture cropped to cover at its stored position. Decoration, so alt="". Data: BannerView. */}} {{define "mapa-banner"}}{{$b := .Banner}}
{{- with .Look}}
RepositionChange bannerRemove banner
{{end}}
{{end}} {{/* mapa-look-row: above a team page's title, Add icon and Add banner (§2.5). Its height is always reserved; its controls are links to the scriptless look page, which mapa.js turns into the picker and the file chooser. Keys: Href, Page, Banner. */}} {{define "mapa-look-row"}}
{{if .Page.Look}}Change icon{{else}}Add icon{{end}} {{if .Banner}}Change banner{{else}}Add banner{{end}}

{{end}}