ath ".markdown") (strings.HasSuffix $path ".md") ) }}
  <!-- add "/index.markdown" to the end -->
  {{ $path = print $path "/index.markdown" }}
{{ end }}

<!-- check if anchor exists, if so add # to the beginning and concat with path -->
{{ if ne $anchor "" }}
  <!-- trim # from the beginning (if any) so we do not need to worry if it's
  already there -->
  {{ $path = print $path "#" (trim $anchor "#") }}
{{ end }}

<!-- now pass it to the relref function -->
{{ $relreflink := relref . $path }}

<!-- if tex