Files
webcoredesktop/layouts/software/single.html
T
2026-10-29 09:52:06 -06:00

65 lines
3.7 KiB
HTML

{{/*
One title in the software catalog (content/software/<name>.md). The
header carries the facts from the front matter: where it's installed
from, the package, the command, what it stands in for, and links to the
project's website and source. The body is the page's Markdown, followed
by the other titles in the same group.
*/}}
{{ define "main" }}
{{ $p := . }}
{{ $source := .Params.source | default "pacman" }}
{{ $pkg := .Params.package }}
{{ $pkgUrl := "" }}
{{ with $pkg }}
{{ if eq $source "pacman" }}{{ $pkgUrl = printf "https://archlinux.org/packages/?name=%s" . }}
{{ else if eq $source "AUR" }}{{ $pkgUrl = printf "https://aur.archlinux.org/packages/%s" . }}
{{ else if eq $source "Flathub" }}{{ $pkgUrl = printf "https://flathub.org/apps/%s" . }}
{{ end }}
{{ end }}
{{ with .Params.packageUrl }}{{ $pkgUrl = . }}{{ end }}
<header class="hero hero-compact has-visual app-hero">
<div class="wrap hero-grid">
<div class="hero-copy">
<p class="note" data-reveal><span class="note-live" aria-hidden="true"></span><span class="note-text"><a href="{{ "software/" | relURL }}">Software</a> · {{ with .Params.category }}<a href="{{ "software/" | relURL }}#{{ . | anchorize }}">{{ . }}</a>{{ end }}</span></p>
<h1 class="statement" data-reveal style="--d:80ms">{{ .Title }}</h1>
{{ with .Params.tagline }}<p class="dek" data-reveal style="--d:140ms">{{ . | markdownify }}</p>{{ end }}
{{ if or .Params.website .Params.code }}
<div class="actions" data-reveal style="--d:200ms">
{{ with .Params.website }}<a href="{{ . }}" class="btn btn-primary">Website<span class="arrow" aria-hidden="true">↗</span></a>{{ end }}
{{ with .Params.code }}<a href="{{ . }}" class="btn btn-secondary">Source code<span class="arrow" aria-hidden="true">↗</span></a>{{ end }}
</div>
{{ end }}
</div>
<dl class="app-facts" data-reveal style="--d:260ms">
<div><dt>Installed from</dt><dd>{{ $source }}{{ with $pkg }} · {{ if $pkgUrl }}<a href="{{ $pkgUrl }}"><code>{{ . }}</code></a>{{ else }}<code>{{ . }}</code>{{ end }}{{ end }}</dd></div>
{{ with .Params.command }}<div><dt>Run it</dt><dd><code>{{ . }}</code></dd></div>{{ end }}
{{ with .Params.replaces }}<div><dt>Use instead of</dt><dd class="app-replaces">{{ range $i, $n := . }}{{ if $i }}<span class="sep">, </span>{{ end }}<s>{{ $n }}</s>{{ end }}</dd></div>{{ end }}
{{ with .Params.website }}<div><dt>Website</dt><dd><a href="{{ . }}">{{ . | strings.TrimPrefix "https://" | strings.TrimPrefix "http://" | strings.TrimPrefix "www." | strings.TrimSuffix "/" }}</a></dd></div>{{ end }}
{{ with .Params.code }}<div><dt>Source</dt><dd><a href="{{ . }}">{{ . | strings.TrimPrefix "https://" | strings.TrimSuffix "/" }}</a></dd></div>{{ end }}
</dl>
</div>
</header>
<section class="section app-body">
<div class="wrap app-layout">
<article class="prose">
{{ .Content }}
{{ with .Params.links }}
<h2 class="app-sub">Further reading</h2>
<ul>{{ range . }}<li><a href="{{ .url }}">{{ .name }}</a></li>{{ end }}</ul>
{{ end }}
</article>
{{ $others := where (where site.RegularPages "Section" "software") "Params.category" .Params.category }}
<aside class="app-aside" aria-labelledby="more-in-group">
<p class="eyebrow" id="more-in-group">More in {{ .Params.category }}</p>
<ul class="app-others">
{{ range $others.ByTitle }}
<li{{ if eq .RelPermalink $p.RelPermalink }} aria-current="page"{{ end }}><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
<a class="more" href="{{ "software/" | relURL }}#catalog">The whole catalog<span class="arrow" aria-hidden="true">→</span></a>
</aside>
</div>
</section>
{{ end }}