blog/themes/farallon/layouts/partials/related.html

30 lines
1.2 KiB
HTML

{{ $related := .Site.RegularPages.Related . | first 5 }}
{{ with $related }}
<div class="related--content">
<h3 class="related--posts__title">{{ i18n "article.relatedContent" }}</h3>
<div class="post--single__related">
{{ range . }}
<div class="post--single__related__item">
<a href="{{ .RelPermalink }}">
<div class="post--single__related__item__img">
{{ if .Content }}
{{ $urls := findRE "<img src=\"[^\"|\\\"]*\"" .Content }} {{ if $urls }} {{ $url :=index ($urls) 0
}} {{ $url :=(strings.TrimPrefix "<img src=\"" $url) }}
{{ $url := strings.TrimRight " \"" $url }} <img src="{{ $url }}" class="cover" />
{{ end }}
{{ end }}
</div>
<div class="post--single__related__item__title">
{{ .Title }}
</div>
<div class="meta">
<time datetime='{{.Date.Format "2006-01-02 15:04:01" }}' class="humane--time">{{ .Date | time.Format
":date_long"
}}</time>
</div>
</a>
</div>
{{ end }}
</div>
</div>
{{ end }}