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

129 lines
4.8 KiB
HTML

<nav class="sidebar">
<div class="sidebar-content sidebar-scrolling">
<a name="menu" id="menu"></a>
<h1 class="sidebar-heading"><a href="{{ .Site.BaseURL }}" title="{{ .Site.Title }} Home">{{ .Site.Title }}</a></h1>
{{- $thumb := "" -}}
{{- if .Params.image -}}
{{- $thumb = .Params.image -}}
{{- else -}}
{{- if .Params.howlongtobeat_id -}}
{{- $thumb = (printf "%scover.jpg" .Page.Permalink) -}}
{{- end -}}
{{- end -}}
{{- if ne $thumb "" -}}
<div class="sidebar-game-info">
<p style="position: relative;">
<img src="{{ $thumb | absURL }}" alt="game cover image" alt="game cover" class="img-responsive img-inactive" style="border: 1px solid black"/>
{{- if ne .CurrentSection.Params.platform .Params.platform -}}
{{- $platform := .CurrentSection.Title -}}
{{- with .CurrentSection.Params.platform -}}
<img src="/img/{{ lower . }}.jpg" alt="{{ $platform }}" alt="platform" class="sidebar-game-platform img-responsive"/>
&nbsp;Played on: <a class="p-category" href="/games/{{ lower . }}">{{ $platform }}</a><br/>
{{- end -}}
{{- 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://www.mobygames.com/search/quick?sFilter=1&offset=0&q={{ . }}&p=-1&sC=on" 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> hr{{ if gt . 1}}s{{ end }}<br/>
{{- end -}}
</p>
</div>
{{- end -}}
{{- $currRellink := substr .RelPermalink 0 -1 -}}
{{- $currContent := .Content -}}
{{- $backlinks := slice -}}
{{- $forwardlinks := slice -}}
{{- range (where (where .Site.Pages.ByDate.Reverse ".Section" "in" (slice "articles" "games")) ".Params.ignore" "!=" "true") -}}
{{- $found := findRE $currRellink .Content 1 -}}
{{- if $found -}}
{{- $backlinks = $backlinks | append . -}}
{{- else -}}
{{- $rellink := substr .RelPermalink 0 -1 -}}
{{- $found = findRE $rellink $currContent 1 -}}
{{- if $found -}}
{{- $forwardlinks = $forwardlinks | append . -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $related := append $backlinks $forwardlinks -}}
{{- if and .Params.Date $related -}}
<div class="sidebar-header">
<span>Related Posts</span>
<img src="/img/gob_purse.gif" alt="related articles" />
</div>
<ul class="sidebar-menu">
{{- range first 5 $related | uniq -}}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a><br/>
<span class="sidebar-description">
{{- if isset .Params "Description" -}}
{{ .Description }}
{{- else -}}
{{ .Summary }}
{{- end -}}
</span>
</li>
{{- end -}}
</ul>
<hr/>
{{- end -}}
<div class="sidebar-header">
<span>Recent Codex Entries</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-description">
{{- if .Description -}}
{{ .Description }}
{{- else if .Summary -}}
{{ .Summary }}
{{- else -}}
A {{ .Params.game_genre }} game by {{ .Params.game_developer }} in {{ .Params.game_release_year }} that takes about {{ .Params.howlongtobeat_hrs }} hour(s) to beat.
{{- 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 }}">{{ .name }}</a></li>
{{- end -}}
</ul>
<div class="copyright">
<p class="credit">
{{- with .Site.Params.copyright -}}
{{ . | safeHTML }}
{{- end -}}
</p>
</div>
</div>
</nav>