asw/archive/packs/caddy/browse.html
exe.dev user e47a9f4401 asw-v01: archive deferred content (packs, site, lab, legacy examples)
- 2.1: packs/ -> archive/packs/
- 2.2: site/ -> archive/site/
- 2.3: src/lab/ -> archive/lab/
- 2.4: examples/ -> archive/examples-legacy/ (SSI-based)
2026-06-07 10:39:21 +02:00

160 lines
4.7 KiB
HTML

{{/*
ASW Caddy Browse Template
Go HTML template for Caddy's file_server browse directive.
Usage in Caddyfile:
file_server browse {
browse {
template_file /path/to/agentic-semantic-web/packs/caddy/browse.html
}
}
Template variables:
.Name — directory name (last segment of path)
.Path — current URL path, e.g. "/files/"
.Files — []FileInfo entries, each with:
.Name, .URL, .Size, .ModTime, .IsDir, .IsSymlink
*/}}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/asw/asw.css">
<title>{{.Name}} — Directory listing</title>
<style>
body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; padding: 2rem; max-width: 90ch; margin: 0 auto; width: 100%; }
.listing {
width: 100%;
border-collapse: collapse;
font-family: var(--asw-font-mono);
font-size: 0.875rem;
}
.listing th {
text-align: left;
padding: 0.5rem 0.75rem;
border-bottom: 1px solid var(--asw-border);
color: var(--asw-text-muted);
font-weight: 500;
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.06em;
}
.listing td {
padding: 0.4rem 0.75rem;
border-bottom: 1px solid color-mix(in srgb, var(--asw-border) 40%, transparent);
color: var(--asw-text-secondary);
vertical-align: middle;
}
.listing tr:hover td { background: color-mix(in srgb, var(--asw-bg-elevated) 60%, transparent); }
.listing .col-name a {
color: var(--asw-accent);
text-decoration: none;
display: flex;
align-items: center;
gap: 0.5em;
}
.listing .col-name a:hover { text-decoration: underline; }
.listing .col-size { text-align: right; color: var(--asw-text-muted); }
.listing .col-modified { white-space: nowrap; color: var(--asw-text-muted); }
.icon { font-size: 0.85em; opacity: 0.7; }
.dir-icon::before { content: "📁"; }
.file-icon::before { content: "📄"; }
.parent-icon::before { content: "⬆️"; font-size: 0.8em; }
.path-breadcrumb {
font-family: var(--asw-font-mono);
font-size: 0.875rem;
color: var(--asw-text-muted);
margin-bottom: 1rem;
}
.path-breadcrumb a { color: var(--asw-accent); text-decoration: none; }
.path-breadcrumb a:hover { text-decoration: underline; }
.path-breadcrumb span { color: var(--asw-text-muted); }
</style>
</head>
<body>
<nav>
<ul><li><a href="/"><strong>Home</strong></a></li></ul>
<ul><li><span data-text="dim">browse</span></li></ul>
</nav>
<main>
<h1>{{.Name}}</h1>
<p class="path-breadcrumb">
{{/* Breadcrumb — split path and link each segment */}}
<a href="/">/</a>
{{- $parts := splitList "/" (trimSuffix "/" .Path) -}}
{{- $acc := "" -}}
{{- range $i, $part := $parts -}}
{{- if $part -}}
{{- $acc = printf "%s/%s" $acc $part -}}
<span>/</span><a href="{{$acc}}/">{{$part}}</a>
{{- end -}}
{{- end -}}
</p>
<table class="listing">
<thead>
<tr>
<th class="col-name">Name</th>
<th class="col-size">Size</th>
<th class="col-modified">Modified</th>
</tr>
</thead>
<tbody>
{{/* Parent directory link */}}
{{if ne .Path "/"}}
<tr>
<td class="col-name">
<a href="../">
<span class="icon parent-icon"></span>
..
</a>
</td>
<td class="col-size"></td>
<td class="col-modified"></td>
</tr>
{{end}}
{{/* Directory entries first */}}
{{range .Files}}{{if .IsDir}}
<tr>
<td class="col-name">
<a href="{{.URL}}">
<span class="icon dir-icon"></span>
{{.Name}}/
</a>
</td>
<td class="col-size"></td>
<td class="col-modified">{{.ModTime.Format "2006-01-02 15:04"}}</td>
</tr>
{{end}}{{end}}
{{/* File entries */}}
{{range .Files}}{{if not .IsDir}}
<tr>
<td class="col-name">
<a href="{{.URL}}">
<span class="icon file-icon"></span>
{{.Name}}
</a>
</td>
<td class="col-size">{{humanizeBytes .Size}}</td>
<td class="col-modified">{{.ModTime.Format "2006-01-02 15:04"}}</td>
</tr>
{{end}}{{end}}
</tbody>
</table>
</main>
<footer>
<p>Styled with <a href="/asw/">Agentic Semantic Web</a></p>
</footer>
</body>
</html>