aa36b2905a
Single-binary Go service that renders markdown pages from a runtime volume mount. Targeted at public, no-auth, no-WAF deployment behind a TLS ingress; security posture is defense-in-depth at every layer: - goldmark with no WithUnsafe — raw HTML in author markdown is stripped - CSP without 'unsafe-inline', plus HSTS, COOP, CORP, Permissions-Policy - static handler rejects non-GET/HEAD, directory listings, dotfiles, traversal - content loader rejects symlinks that escape the content root, dotfiles, and .md files larger than 1 MiB - per-page template trees (cloned from layout) so define-blocks don't collide between home/category/page - SIGHUP triggers atomic library swap — live edits on volume, no rebuild Locale layout content/<locale>/<category>/<slug>.md. Categories without _index.md still appear on the home page with a humanized name. Search is a ~70-line vanilla JS scan over /search.json?lang=<locale>; swap for a real indexer if the corpus ever balloons. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
44 lines
1.3 KiB
HTML
44 lines
1.3 KiB
HTML
{{define "layout"}}<!doctype html>
|
||
<html lang="{{.Locale}}">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>{{block "title" .}}automc tutorials{{end}}</title>
|
||
<link rel="stylesheet" href="/static/style.css">
|
||
</head>
|
||
<body>
|
||
<header class="site-header">
|
||
<a class="brand" href="/{{.Locale}}/">automc tutorials</a>
|
||
<div class="search">
|
||
<input type="search" id="search-input" placeholder="Search..." autocomplete="off">
|
||
<ul id="search-results" hidden></ul>
|
||
</div>
|
||
<nav class="locale-switch">
|
||
{{range .Locales}}
|
||
<a href="/{{.}}/" class="lang {{if eq . $.Locale}}active{{end}}">{{.}}</a>
|
||
{{end}}
|
||
</nav>
|
||
</header>
|
||
|
||
{{with .Path}}
|
||
<nav class="breadcrumbs">
|
||
<a href="/{{$.Locale}}/">home</a>
|
||
{{range .}}
|
||
<span class="sep">›</span>
|
||
{{if .URL}}<a href="{{.URL}}">{{.Label}}</a>{{else}}<span class="active">{{.Label}}</span>{{end}}
|
||
{{end}}
|
||
</nav>
|
||
{{end}}
|
||
|
||
<main>
|
||
{{block "content" .}}{{end}}
|
||
</main>
|
||
|
||
<footer class="site-footer">
|
||
<span>automc-tutorials · <a href="https://git.timemachine.center/Timemachine/automc-tutorials">source</a></span>
|
||
</footer>
|
||
|
||
<script src="/static/search.js" defer></script>
|
||
</body>
|
||
</html>{{end}}
|