Separate out the HTML template

This commit is contained in:
2026-04-10 09:15:39 +02:00
parent 6a09fe4d98
commit fe99756cbd
3 changed files with 50 additions and 44 deletions

47
assets/page.html Normal file
View File

@@ -0,0 +1,47 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>{{.Title}}</title>
<link rel="stylesheet" href="/_/style.css" />
</head>
<body>
<header>
<nav class="breadcrumb">
<a href="/">~</a>
{{range .Crumbs}}<span class="sep">/</span
><a href="{{.URL}}">{{.Name}}</a>{{end}}
</nav>
{{if .CanEdit}}<a class="edit-btn" href="?edit">EDIT</a>{{end}}
</header>
<main>
{{if .EditMode}}
<form class="edit-form" method="POST" action="{{.PostURL}}">
<textarea name="content" autofocus>{{.RawContent}}</textarea>
<div class="form-actions">
<button class="btn-save" type="submit">Save</button>
<a class="btn-cancel" href="{{.PostURL}}">Cancel</a>
</div>
</form>
{{else}} {{if .Content}}
<div class="content">{{.Content}}</div>
{{end}} {{if .Entries}}
<div class="listing">
<div class="listing-header">Contents</div>
{{range .Entries}}
<div class="listing-item">
<span class="icon">{{.Icon}}</span>
<a href="{{.URL}}">{{.Name}}</a>
<span class="meta">{{.Meta}}</span>
</div>
{{end}}
</div>
{{else if not .Content}}
<p class="empty">
Empty folder — <a href="?edit">create index.md</a>
</p>
{{end}} {{end}}
</main>
</body>
</html>