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

110 lines
3.7 KiB
HTML

{{ $url := .Site.BaseURL }}
<nav class="sidebar col-xs-6 col-sm-4 col-md-3 sidebar-offcanvas">
<div class="sidebar-content sidebar-scrolling">
<h1 class="sidebar-heading"><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></h1>
{{ $thumb := "" }}
{{ if .Params.image }}
{{ $thumb = .Params.image }}
{{ else }}
{{ if .Params.howlongtobeat_id }}
{{ $thumb = printf "%s%d%s" "img/hltb/" .Params.howlongtobeat_id ".jpg" }}
{{ end }}
{{ end }}
{{ if ne $thumb "" }}
<div class="sidebar-game-info">
<p style="position: relative;">
<img src="{{ $url }}{{ $thumb }}" alt="game cover image" alt="game cover" class="img-responsive img-inactive" style="border: 1px solid black"/>
{{ with .Params.game_platform }}
<img src="{{ $url }}img/{{ lower . }}.png" alt="{{ . }}" alt="platform" class="sidebar-game-platform img-responsive"/>
&nbsp;Played on: <a href="/platforms/{{ lower . }}">{{ . }}</a><br/>
{{ end }}
{{ with .Params.game_genre }}
{{ $tag := replaceRE `\s` "-" . }}
&nbsp;Genre: <a href="/tags/{{ $tag | lower }}">{{ . }}</a><br/>
{{ end }}
{{ with .Params.game_release_year }}
&nbsp;Release year: {{ . }}<br/>
{{ end }}
{{ with .Params.game_developer }}
&nbsp;Developer: <a href="https://en.wikipedia.org/wiki/{{ . }}" target="_blank" rel="noopener" class="external">{{ . }}</a><br/>
{{ end }}
{{ with .Params.howlongtobeat_id }}
&nbsp;<a href="https://howlongtobeat.com/game?id={{ . }}" target="_blank" rel="noopener" class="external">How long to beat</a>
{{ end }}
{{ with .Params.howlongtobeat_hrs }}
: <code>{{ . }}</code> hours<br/>
{{ end }}
</p>
</div>
{{ end }}
<!-- ripped from BB's minimal theme -->
{{ $related := first 4 (where (where .Site.Pages.ByDate.Reverse ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }}
{{ if $related }}
<div class="sidebar-header">
<span>Related Posts</span>
<img src="/img/gob_purse.gif" alt="related articles" />
</div>
<ul class="sidebar-menu">
{{ range $related }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a><br/>
<span class="sidebar-date">
{{ if isset .Params "Description" }}
{{ .Description }}
{{ else }}
{{ .Summary }}
{{ end }}
</span>
</li>
{{ end }}
</ul>
<hr/>
{{ end }}
<div class="sidebar-header">
<span>New Posts</span>
<img src="/img/gob_letter.gif" alt="latest articles" />
</div>
<ul class="sidebar-menu">
{{ range first 5 (where (where .Site.Pages.ByDate.Reverse ".Section" "in" (slice "articles" "games")) ".Params.ignore" "!=" "true") }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a><br/>
<span class="sidebar-date">
{{ if isset .Params "Description" }}
{{ .Description }}
{{ else }}
{{ .Summary }}
{{ end }}
</span>
</li>
{{ end }}
</ul>
<div class="sidebar-header">
<span>Looking For More?</span>
<img src="/img/gob_waypoint.gif" alt="More information" />
</div>
<ul class="sidebar-menu">
{{ range .Site.Params.navlinks }}
<li><a href="{{ $url }}{{ .url }}">{{ .name }}</a></li>
{{ end }}
</ul>
<div class="copyright">
<p class="credit">
{{ with .Site.Params.copyright }}
{{ . | safeHTML }}
{{ end }}
</p>
</div>
</div>
</nav>