{{define "content"}}
{{$p := .Page}}
<article class="markdown">
{{.Body}}
</article>
<aside class="sidebar">
  {{if .Meta}}
  <section class="meta">
    <h3>Metadata</h3>
    <dl>
      {{if .Meta.Type}}<dt>Type</dt><dd>{{.Meta.Type}}</dd>{{end}}
      {{if .Meta.Description}}<dt>Description</dt><dd>{{.Meta.Description}}</dd>{{end}}
      {{if .Meta.Resource}}<dt>Resource</dt><dd><a href="{{.Meta.Resource}}" rel="noopener noreferrer">{{.Meta.Resource}}</a></dd>{{end}}
      {{if .Meta.Tags}}<dt>Tags</dt><dd>{{range .Meta.Tags}}<a class="tag" href="/list?tag={{.}}">{{.}}</a> {{end}}</dd>{{end}}
      {{if .Meta.Timestamp}}<dt>Updated</dt><dd>{{.Meta.Timestamp}}</dd>{{end}}
    </dl>
  </section>
  {{end}}
  {{if .TOC}}
  <nav class="toc">
    <h3>On this page</h3>
    <ul>
    {{range .TOC}}<li class="toc-l{{.Level}}"><a href="#{{.ID}}">{{.Text}}</a></li>{{end}}
    </ul>
  </nav>
  {{end}}
  {{if $p.Outbound}}
  <section class="links">
    <h3>Links to</h3>
    <ul>{{range $p.Outbound}}<li><a href="/wiki/{{.Slug}}">{{.Title}}</a>{{if .Type}} <span class="pill">{{.Type}}</span>{{end}}</li>{{end}}</ul>
  </section>
  {{end}}
  {{if $p.Inbound}}
  <section class="links">
    <h3>Linked from</h3>
    <ul>{{range $p.Inbound}}<li><a href="/wiki/{{.Slug}}">{{.Title}}</a>{{if .Type}} <span class="pill">{{.Type}}</span>{{end}}</li>{{end}}</ul>
  </section>
  {{end}}
</aside>
{{end}}
