Files
kls/templates/index.html
Kyle Isom f96e8cfaf2 Add custom short code support to web UI
Allow users to optionally specify their own short code when
shortening a URL, instead of always generating a random one.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 21:55:59 -07:00

32 lines
1.0 KiB
HTML

{{define "title"}} — Shorten{{end}}
{{define "content"}}
<h2>Shorten a URL</h2>
{{if (ne .Short "")}}
<div class="success">
Short code: <a href="/{{.Short}}">{{.Short}}</a>
</div>
{{end}}
<div class="card">
<form method="POST" action="/">
{{csrfField}}
<div class="form-group">
<label for="value">URL</label>
<input type="text" id="value" name="value" placeholder="https://..." required>
</div>
<div class="form-group">
<label for="custom">Custom short code (optional)</label>
<input type="text" id="custom" name="custom" placeholder="e.g. mylink" pattern="[a-zA-Z0-9]+" title="Letters and numbers only">
</div>
<div class="form-group">
<label>
<input type="checkbox" name="strip"> Strip query string
</label>
</div>
<div class="form-actions">
<button type="submit" class="btn">Shorten</button>
<a href="/list" class="btn-ghost btn">View all</a>
</div>
</form>
</div>
{{end}}