{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository wiki">
	{{template "repo/header" .}}
	<div class="ui container">
		<div class="repo-button-row">
			<div class="tw-flex tw-items-center tw-gap-2">
				<a class="ui small button" href="{{.RepoLink}}/wiki/{{.PageURL}}">
					{{svg "octicon-arrow-left" 14}} Back to {{.title}}
				</a>
			</div>
		</div>

		<h2>{{svg "octicon-cross-reference" 20}} What links here: {{.title}}</h2>

		{{if .Backlinks}}
		<div class="ui relaxed divided list">
			{{range .Backlinks}}
			<div class="item">
				<div class="content">
					<a class="header" href="{{$.RepoLink}}/wiki/{{.PageURL}}">{{.PageName}}</a>
					{{if .Context}}
					<div class="description">
						<code class="tw-text-sm">{{.Context}}</code>
					</div>
					{{end}}
				</div>
			</div>
			{{end}}
		</div>
		<p class="tw-mt-4 text grey">{{.BacklinkCount}} {{if eq .BacklinkCount 1}}page{{else}}pages{{end}} linking here.</p>
		{{else}}
		<div class="ui placeholder segment">
			<div class="ui icon header">
				{{svg "octicon-unlink" 48}}
				<br>
				No pages link to "{{.title}}"
			</div>
		</div>
		{{end}}
	</div>
</div>
{{template "base/footer" .}}
