Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code7 template used by the Caddy browse directive
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<link rel="stylesheet" href="http://c7.se/css/main.css">
<style>
body { font-family: 'Helvetica Neue', Sans-serif; }
#list {
width: 100%;
}
th,td {
border-color: #eee;
padding: 0.2em 0.5em;
}
.path {
margin-top: 0.6em;
margin-bottom: 0.6em;
font-weight: bold;
font-size: 1.3em;
color: #333;
}
</style>
</head>
<body>
<div class="container">
<a href="/"><img src="http://c7.se/images/logo.png" alt="code7 interactive" /></a>
<h1 class="path">{{.Path}}</h1>
<table id="list" cellpadding="0.1em" cellspacing="0">
<thead>
<tr>
<th>File Name</th>
<th>File Size</th>
<th>Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>
{{if .CanGoUp}}
<a href="..">Parent directory/</a>
{{else}}
Parent directory/
{{end}}
</td>
<td>-</td>
<td>-</td>
</tr>
{{range .Items}}
{{if .IsDir}}
<tr>
<td><a href="{{.URL}}">{{.Name}}/</a></td>
<td>-</td>
<td>{{.HumanModTime "2006-01-02 15:04"}}</td>
</tr>
{{end}}
{{end}}
{{range .Items}}
{{if not .IsDir}}
{{if ne .Name "Caddyfile" }}
<tr>
<td><a href="{{.URL}}">{{.Name}}</a></td>
<td>{{.HumanSize}}</td>
<td>{{.HumanModTime "2006-01-02 15:04"}}</td>
</tr>
{{end}}
{{end}}
{{end}}
</tbody>
</table>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.