jefklakscodex/themes/jefklak-creative-portfolio/layouts/partials/portfolio-block.html

46 lines
1.7 KiB
HTML

<article class="box-masonry">
<a href="{{ .Permalink }}" title="{{ .Params.title }}" class="box-masonry-image">
{{ $thumb := "/img/logo.png" | absURL }}
{{ if .Params.image }}
{{ $thumb = .Params.image | absURL }}
{{ else if .Params.howlongtobeat_id }}
{{ $thumb = (printf "%scover.jpg" .Page.Permalink) | absURL }}
{{ else }}
<!-- taken from head-meta.html in brainabking -->
{{ $perm := .Permalink }}
{{ $base := .Site.BaseURL }}
{{ $match := findRE `!\[(.*)\]\((.+).(jpg|png|gif)` .RawContent 1 }}
{{ range $match }}
{{ $relthumb := replaceRE `!\[(.*)\]\(` "" . }}
{{ if hasPrefix $relthumb "/" }}
{{ $thumb = printf "%s%s" $base $relthumb }}
{{ else }}
{{ $thumb = printf "%s%s" $perm $relthumb }}
{{ end }}
{{ end }}
{{ end }}
<img loading="lazy" src="{{ $thumb }}" alt="thumbnail of {{ .Title }}" style="display: block; max-width: 100%">
</a>
<div class="box-masonry-text">
<h4><a href="{{ .Permalink }}">{{ .Title }}</a></h4>
{{ if .Date }}
{{ .Date.Format (.Site.Params.dateFormat | default "02/01/2006") | $.Scratch.Set "subtitle" }}
<span class="sidebar-date" style="float: right;">
<svg class='icon icon-inline'>
<use xlink:href='#cal1'></use>
</svg>
{{ $.Scratch.Get "subtitle" }}
</span>
{{ end }}
<div class="box-masonry-description">
<p>
{{ if isset .Params "score" }}<strong>{{ partial "scorelabel" . }} |</strong>{{ end }}
{{ .Summary | truncate 150 }}
</p>
</div>
</div> <!-- box-masonry-text -->
</article>