clone

a personal forge on plain git: static pages, stacked-diff reviews, signed local ci, repo sites and releases

main
forge / site / _includes / base.njk
base.njk 4.3K
1{#- The layout every page extends. A page fills the content block, and may2 replace head (its description and link preview), scripts (any script only3 it needs), heading (the title in the header) and front (what is between4 a repo's title and its tabs). -#}5{% import "macros.njk" as m with context %}6{% import "ui.njk" as ui %}7{% set r = p.repo if p else null %}8{% set br = p.branch.name if p and p.branch else (r.defaultBranch if r else '') %}9<!DOCTYPE html>10<html lang="en">11<head>12<meta charset="utf-8">13<meta name="viewport" content="width=device-width, initial-scale=1">14<title>{% block title %}{{ p.title if p and p.title else forge.config.name }}{% endblock %}</title>15<link rel="icon" href="{{ assets.logo }}" type="image/svg+xml">16<link rel="preload" href="{{ assets['open-sans'] }}" as="font" type="font/woff2" crossorigin>17<link rel="stylesheet" href="{{ assets.style }}">18{# The CSS that this page's templates and includes carry ({% css %}). -#}19<link rel="stylesheet" href="{% getBundleFileUrl "css" %}">20{% if r %}21<link rel="alternate" type="application/atom+xml" title="{{ r.slug }}" href="{{ r.urls.atom.href }}">22{% endif %}23<script src="{{ assets.fixi }}" defer></script>24<script src="{{ assets.ssexi }}" defer></script>25<script src="{{ assets.live }}" defer></script>26<script src="{{ assets.keys }}" defer></script>27<script type="module" src="{{ assets.search }}"></script>28<script src="{{ assets.ui }}" defer></script>29{% block scripts %}{% endblock %}30{% block head %}{{ m.meta(p.title if p and p.title else forge.config.name, r.description if r else '') }}{% endblock %}31</head>32<body{% if p and p.filesHref %} data-files="{{ p.filesHref }}" data-blob="{{ r.urls.blobBase(br).href }}"{% endif %}>33<header class="site">34<div class="wrap">35<div class="top">36<a class="logo" href="/" data-key="g" title="{{ forge.config.name }}: all repositories" aria-label="{{ forge.config.name }}">{% include "logo.njk" %}</a>37<div class="title">38{% block heading %}39{% if r %}<a href="/{{ r.owner }}/">{{ r.owner }}</a> / <a href="{{ r.urls.home.href }}" data-key="h"><b>{{ r.name }}</b></a>{% if r.private %} <a class="private-mark" href="/private/" title="a private repo: only its readers see its pages">private</a>{% endif %}40{% else %}<b>{{ forge.config.name }}</b>{% endif %}41{% endblock %}42</div>43<span class="spacer"></span>44<div id="live" class="live" aria-live="polite"{% if r %} data-repo="{{ r.slug }}"{% endif %} fx-action="/events/{{ r.slug + '/' if r else '' }}" fx-trigger="fx:inited" fx-target="#live" fx-swap="innerHTML"></div>45{% include "search.njk" %}46{% if r %}47<details class="clone">48<summary>clone</summary>49<div class="panel">50<div class="copyrow"><label>ssh</label>{{ ui.input('ssh clone url', r.urls.cloneSsh, 'readonly', true) }}{{ ui.button('copy', false, 'data-copy="' + r.urls.cloneSsh + '"') }}</div>51{% if r.urls.cloneHttp %}<div class="copyrow"><label>https</label>{{ ui.input('https clone url', r.urls.cloneHttp, 'readonly', true) }}{{ ui.button('copy', false, 'data-copy="' + r.urls.cloneHttp + '"') }}</div>{% endif %}52{% if r.private %}<p class="clone-note">HTTPS takes a token: <code>ssh {{ forge.config.ssh }} token --repo {{ r.slug }}</code></p>{% endif %}53</div>54</details>55{% endif %}56</div>57{# A repo's code page puts its front matter here (repo/home.njk). #}58{% block front %}{% if r and r.description %}<p class="repo-desc">{{ r.description }}</p>{% endif %}{% endblock %}59{% if r %}60{{ ui.tabs('repository', [61 {href: r.urls.home.href, text: 'code', key: 'f', cur: p.nav == 'files' or p.nav == 'home'},62 {href: r.urls.log(br).href, text: 'commits', key: 'l', cur: p.nav == 'log'},63 {href: r.urls.refs.href, text: 'branches', key: 'b', cur: p.nav == 'refs'},64 {href: r.urls.reviews.href, text: 'reviews', key: 'r', cur: p.nav == 'reviews'},65 {href: r.urls.wiki().href if r.counts.wiki else '', text: 'wiki', key: 'w', cur: p.nav == 'wiki', off: not r.counts.wiki},66 {href: r.urls.sites.href, text: 'sites', key: 's', cur: p.nav == 'sites', off: not r.counts.sites},67 {href: r.urls.releases.href, text: 'releases', key: 'e', cur: p.nav == 'releases', off: not r.counts.releases},68 {href: r.urls.insights.href, text: 'insights', key: 'i', cur: p.nav == 'insights'}69]) }}70{% endif %}71</div>72</header>73<main id="content" class="wrap">74{% block content %}{% endblock %}7576</main>77{% include "help.njk" %}78</body>79</html>