Sites → Sections and pages reads the website's Hugo repository: each section type with the README's description, the fields in use and the layout's, the pages using it and a real example; the pages and their sections; the latest commits. Working copies are now held by one job at a time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
70 lines
4.3 KiB
HTML
70 lines
4.3 KiB
HTML
{{define "content"}}{{with .Data}}{{$d := .}}
|
|
<div class="heading"><h1>Your site</h1></div>
|
|
<p class="lede">What your website is built from. Its pages are lists of sections, and each section type has its own layout in the site's repository. Supermarket reads those types, the fields they take and how your pages use them, and builds new pages only from them. It changes the site only through pull requests; merging publishes.</p>
|
|
|
|
{{if not .Sites}}
|
|
<section class="card empty"><p>Add your website and its Hugo repository under <a href="/settings/profile">Settings → Profile</a> first.</p></section>
|
|
{{else}}
|
|
{{if gt (len .Sites) 1}}<nav class="tabs">{{range .Sites}}<a href="/sites?site={{.Index}}" {{if and $d.Current (eq .Index $d.Current.Index)}}aria-current="page"{{end}}>{{.URL}}</a>{{end}}</nav>{{end}}
|
|
{{with .Current}}{{$cur := .}}
|
|
<section class="card">
|
|
{{if .Err}}
|
|
<p class="warn-text">{{.URL}}: {{.Err}}. Set it under <a href="/settings/profile">Settings → Profile</a> (the repository as owner/name).</p>
|
|
{{else}}
|
|
<form method="post" action="/sites/sync" class="row">
|
|
<input type="hidden" name="site" value="{{.Index}}">
|
|
<div>
|
|
<strong>{{.URL}}</strong> <span class="muted">from {{.Repo}}{{with $d.Synced.Branch}}, branch {{.}}{{end}}</span>
|
|
<p class="small muted">{{if $d.HasSynced}}{{if not $d.Synced.At.IsZero}}Read from the repository {{ago $d.Synced.At}}.{{end}}{{else}}Not read yet.{{end}}</p>
|
|
</div>
|
|
<button type="submit" data-busy="Reading…" {{if not $d.Gitea}}disabled title="Save a Gitea token under Settings → Search engines"{{end}}>{{if $d.HasSynced}}Read it again{{else}}Read the repository{{end}}</button>
|
|
</form>
|
|
{{with $d.Synced.Err}}<p class="error-text">The last read failed: {{.}}</p>{{end}}
|
|
{{if not $d.Gitea}}<p class="small">Supermarket reads the repository with your Gitea token: save one under <a href="/settings/search">Settings → Search engines</a>.</p>{{end}}
|
|
{{end}}
|
|
</section>
|
|
{{end}}
|
|
|
|
{{with .Catalog}}
|
|
{{with $d.Commits}}
|
|
<h2>Latest on the published branch</h2>
|
|
<div class="table-wrap"><table class="compact">
|
|
<thead><tr><th>When</th><th>Who</th><th>What</th></tr></thead>
|
|
<tbody>{{range .}}<tr><td>{{ago .At}}</td><td>{{.Author}}</td><td>{{.Subject}}</td></tr>{{end}}</tbody>
|
|
</table></div>
|
|
{{end}}
|
|
|
|
<h2>Section types</h2>
|
|
<p class="help">{{len .Types}} types{{with .Helpers}}, sharing {{join . ", "}}{{end}}. Most used first. Open one to see the fields it takes and a real example.</p>
|
|
{{range .Types}}
|
|
<details class="card">
|
|
<summary>{{.Name}} <span class="badge">{{if .Uses}}{{.Uses}} use{{if ne .Uses 1}}s{{end}} on {{len .Pages}} page{{if ne (len .Pages) 1}}s{{end}}{{else}}not used yet{{end}}</span>{{if .Missing}} <span class="badge failed">no layout</span>{{end}}</summary>
|
|
{{if .Missing}}<p class="warn-text">Pages use this type, but there's no <code>layouts/partials/sections/{{.Name}}.html</code>, so it won't show. Supermarket won't use it.</p>{{end}}
|
|
{{with .Doc}}<p><strong>The README says:</strong> {{ticks .}}</p>{{end}}
|
|
{{if .Fields}}<p><strong>Fields in use:</strong> {{range $i, $f := .Fields}}{{if $i}}, {{end}}<code>{{$f.Name}}</code>{{with $f.Items}} (items: {{join . ", "}}){{end}}{{end}}</p>{{end}}
|
|
{{with .Layout}}<p class="small"><strong>The layout reads:</strong> {{join . ", "}}</p>{{end}}
|
|
{{with .Pages}}<p class="small"><strong>On:</strong> {{join . ", "}}</p>{{end}}
|
|
{{with .Example}}<pre class="sample">{{.}}</pre>{{end}}
|
|
</details>
|
|
{{end}}
|
|
|
|
<h2>Pages</h2>
|
|
{{with $d.SectionPages}}
|
|
<div class="table-wrap"><table class="compact">
|
|
<thead><tr><th>Address</th><th>Title</th><th>Sections</th></tr></thead>
|
|
<tbody>{{range .}}<tr><td><a href="{{$d.Current.Base}}{{.Path}}" target="_blank" rel="noopener noreferrer">{{.Path}}</a>{{if .Draft}} <span class="badge draft">draft</span>{{end}}</td><td>{{.Title}}</td><td class="small">{{join .Types " · "}}</td></tr>{{end}}</tbody>
|
|
</table></div>
|
|
{{else}}<p class="help">No page is built from sections yet.</p>{{end}}
|
|
{{with $d.OtherPages}}
|
|
<details class="card">
|
|
<summary>{{len .}} other pages, written in Markdown</summary>
|
|
<div class="table-wrap"><table class="compact">
|
|
<thead><tr><th>Address</th><th>Title</th></tr></thead>
|
|
<tbody>{{range .}}<tr><td>{{.Path}}{{if .Draft}} <span class="badge draft">draft</span>{{end}}</td><td>{{.Title}}</td></tr>{{end}}</tbody>
|
|
</table></div>
|
|
</details>
|
|
{{end}}
|
|
{{end}}
|
|
{{end}}
|
|
{{end}}{{end}}
|