{{/* Expect to have context bound to ".ctx", and the top level
     "version" and "pageUrl" passed in with the context.
 */}}
 {{/* In the current "ctx" the file path refers to the doc we are linking to, not the page we are on */}}
 {{- $contentVersion := index (split .ctx.File.Path "/") 1 -}}
 {{- $isRoot := eq (len (split .ctx.File.Path "/")) 2 -}}
{{- $title := cond (isset .ctx.Params "navtitle") (.ctx.Params.navtitle) .ctx.Title -}}
{{- if not $isRoot -}}
{{- if eq .version $contentVersion -}}
{{- $linkRef := .ctx.Permalink -}}
<a class="navbar-item" href="{{ $linkRef }}">
  {{ $title }}
</a>
{{- end -}}
{{- end -}}