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

37 lines
1.6 KiB
HTML

<article>
<a href="{{ .Permalink }}" title="" class="box-masonry-image with-hover-overlay with-hover-icon">
{{ $thumb := "/img/logo.png" | absURL }}
{{ if .Params.image }}
{{ $thumb = .Params.image | absURL }}
{{ else if .Params.howlongtobeat_id }}
{{ $thumb = printf "%s%d%s" "img/hltb/" .Params.howlongtobeat_id ".jpg" | 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 {{ .Params.game_name }}" class="img-responsive img-inactive screenshot">
</a>
<h4><a href="{{ .Permalink }}" class="name">{{ .Params.game_name }}</a></h4>
<div>
<time datetime='{{ .Date.Format "2006-01-02" }}' class="date" title="Created Date">{{ .Date.Format "2006-01-02" }}</time>
<p>
{{ .Params.game_developer }} (<span class="year">{{ .Params.game_release_year }}</span>)<br/>
{{ with .Params.howlongtobeat_hrs }}
<code class="hours">{{ . }}</code> hr{{ if gt . 1}}s{{ end }}.
{{ end }}
</p>
{{ .Scratch.Set "simplescore" 1 }}
{{ partial "score" . }}
</div>
</article>