docs-v2/layouts/partials/article/related.html

20 lines
638 B
HTML

{{ if .Params.related }}
<div class="related">
<h4 id="related-articles">Related articles</h4>
<ul>
{{ range .Params.related }}
{{ if or (in . "http") (in . "/v2.0/api") }}
{{ $link := replaceRE `\,\s(.*)$` "" . }}
{{ $title := replaceRE `^(\S*\,\s)` "" . }}
<li><a href="{{ $link }}" target="_blank">{{ $title }}</a></li>
{{ else }}
{{ $sanitizedPath := replaceRE `\/$` "" (print .) }}
{{ with $.Page.GetPage $sanitizedPath }}
<li><a href="{{ .RelPermalink }}" >{{ .Title }}</a></li>
{{ end }}
{{ end }}
{{ end }}
</ul>
</div>
{{ end }}