related series: add to the rss feed
This commit is contained in:
parent
5b8d1c8a34
commit
02301428b7
|
@ -45,57 +45,101 @@
|
|||
<category>{{ . }}</category>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ $lazyLoadImg := "data-src=" }}
|
||||
{{ $eagerLoadImg := "src=" }}
|
||||
{{ $contentImg := .Content | replaceRE $lazyLoadImg $eagerLoadImg | safeHTML }}
|
||||
{{- $lazyLoadImg := "data-src=" -}}
|
||||
{{- $eagerLoadImg := "src=" -}}
|
||||
{{- $contentImg := .Content | replaceRE $lazyLoadImg $eagerLoadImg | safeHTML -}}
|
||||
|
||||
{{ $content := .Content }}
|
||||
{{- $content := .Content -}}
|
||||
<!-- relative images/URLs do not work in some feed readers. Thanks, Peter. See render-image.html -->
|
||||
{{ $content = replaceRE `a href="(#.*?)"` (printf "%s%s%s" "a href=\"" .Permalink "$1\"") $content }}
|
||||
{{ $content = replaceRE `a href="/(.*?)"` (printf "%s%s%s" "a href=\"" $baseurl "$1\"") $content }}
|
||||
{{- $content = replaceRE `a href="(#.*?)"` (printf "%s%s%s" "a href=\"" .Permalink "$1\"") $content -}}
|
||||
{{- $content = replaceRE `a href="/(.*?)"` (printf "%s%s%s" "a href=\"" $baseurl "$1\"") $content -}}
|
||||
<description>
|
||||
{{ `<![CDATA[ ` | safeHTML }}
|
||||
{{ $content | safeHTML }}
|
||||
|
||||
{{ if isset .Params "score" }}
|
||||
<p>
|
||||
{{ $score := .Params.score }}
|
||||
{{- $score := .Params.score -}}
|
||||
<strong>Verdict</strong>: {{ $score }}/5—{{ if eq $score 5 }}Amazing{{ else if eq $score 4 }}Great{{ else if eq $score 3 }}Good{{ else if eq $score 2 }}Mediocre{{ else if eq $score 1 }}Bad{{ else }}Indifferent{{ end}}.
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
{{- $series := slice -}}
|
||||
{{- if isset .Params "series" -}}
|
||||
{{- $series = (where .Site.Pages ".Params.series" "eq" .Params.series).ByParam "game_release_year" -}}
|
||||
{{- $has_series := $series | len -}}
|
||||
{{ if gt $has_series 1 }}
|
||||
<p>
|
||||
<strong><em>{{ .Params.series }}</em> series</strong> ▹
|
||||
{{- range $series -}}
|
||||
<a href="{{ .Permalink }}">{{ .Params.game_name }}</a> ○
|
||||
{{- end -}}
|
||||
</p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{- $currRellink := substr .RelPermalink 0 -1 -}}
|
||||
{{- $currContent := .Content -}}
|
||||
{{- $currTitle := .Title -}}
|
||||
{{- $backlinks := slice -}}
|
||||
{{- $forwardlinks := slice -}}
|
||||
{{- range (where (where .Site.Pages ".Section" "in" (slice "articles" "games")) ".Params.ignore" "!=" "true") -}}
|
||||
{{- $found := findRE $currRellink .Content 1 -}}
|
||||
{{- if and $found (ne .Title $currTitle) -}}
|
||||
{{- $backlinks = $backlinks | append . -}}
|
||||
{{- else -}}
|
||||
{{- $rellink := substr .RelPermalink 0 -1 -}}
|
||||
{{- $found = findRE $rellink $currContent 1 -}}
|
||||
{{- if and $found (ne .Title $currTitle) -}}
|
||||
{{- $forwardlinks = $forwardlinks | append . -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $rel := append $backlinks $forwardlinks -}}
|
||||
{{ $related := (where ($rel | complement $series) ".Params.game_name" "ne" nil) }}
|
||||
{{ $has_related := $related | len }}
|
||||
{{ if gt $has_related 0 }}
|
||||
{{- $related = sort $related ".Params.game_release_year" "asc" }}
|
||||
<p>
|
||||
<strong>Related games</strong> ▹
|
||||
{{- range $related | uniq -}}
|
||||
<a href="{{ .Permalink }}">{{ .Params.game_name }}</a> ○
|
||||
{{- end -}}
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
<p>
|
||||
By <a href="/about">{{ .Site.Author.name }}</a> on <time datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format (.Site.Params.dateFormat | default "2 January 2006") }}</time>.
|
||||
</p>
|
||||
{{ if .Params.game_name }}
|
||||
<hr/>
|
||||
<p>
|
||||
{{ $platform := .CurrentSection.Title }}
|
||||
{{- $platform := .CurrentSection.Title -}}
|
||||
{{ with .CurrentSection.Params.platform }}
|
||||
Played on: <a href="/games/{{ lower . }}">{{ $platform }}</a><br/>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{ with .Params.game_genre }}
|
||||
{{ $tag := replaceRE `\s` "-" . }}
|
||||
Genre: <a href="/tags/{{ $tag | lower }}">{{ . }}</a><br/>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{ with .Params.game_release_year }}
|
||||
Release year: {{ . }}<br/>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{ with .Params.game_developer }}
|
||||
Developer: {{ . }}<br/>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
{{ with .Params.howlongtobeat_hrs }}
|
||||
How long to beat: <code>{{ . }}</code> hr{{ if gt . 1}}s{{ end }}<br/>
|
||||
{{ end }}
|
||||
{{- end -}}
|
||||
|
||||
{{ $thumb := "" }}
|
||||
{{ if .Params.image }}
|
||||
{{ $thumb = .Params.image }}
|
||||
{{ else }}
|
||||
{{ if .Params.howlongtobeat_id }}
|
||||
{{ $thumb = (printf "%scover.jpg" .Page.Permalink) }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{- $thumb := "" -}}
|
||||
{{- if .Params.image -}}
|
||||
{{- $thumb = .Params.image -}}
|
||||
{{- else -}}
|
||||
{{- if .Params.howlongtobeat_id -}}
|
||||
{{- $thumb = (printf "%scover.jpg" .Page.Permalink) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{ if ne $thumb "" }}
|
||||
<img src="{{ $thumb | absURL }}" alt="game cover image" alt="game cover" style="border: 1px solid black"/>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in New Issue