Add related artworks

This commit is contained in:
Joshua Goins 2024-10-18 15:37:42 -04:00
parent e86cdf2093
commit fc360e3d62
2 changed files with 82 additions and 0 deletions

View file

@ -215,3 +215,44 @@ languages:
- img: 'icons/pixiv.svg'
url: 'https://www.pixiv.net/en/users/58118005'
weight: 2
related:
includeNewer: true
indices:
- applyFilter: false
cardinalityThreshold: 0
name: keywords
pattern: ""
toLower: false
type: basic
weight: 100
- applyFilter: false
cardinalityThreshold: 0
name: date
pattern: ""
toLower: false
type: basic
weight: 10
- applyFilter: false
cardinalityThreshold: 0
name: tags
pattern: ""
toLower: false
type: basic
weight: 80
- applyFilter: false
cardinalityThreshold: 0
name: arttags
pattern: ""
toLower: false
type: basic
weight: 10
- applyFilter: false
cardinalityThreshold: 0
name: characters
pattern: ""
toLower: false
type: basic
weight: 80
threshold: 9
toLower: false

View file

@ -75,6 +75,47 @@
<script type="module" src="{{ $site.RelPermalink }}" integrity="{{ $site.Data.Integrity }}"></script>
{{ end }}
{{ $related := .Site.RegularPages.Related . | first 3 }}
{{ with $related }}
<h3>Related Art</h3>
<div class="generic-con" style="display: flex; flex-wrap: wrap;">
{{ range . }}
<figure class="gallery-fig">
{{ $filename_without_ext := .Params.slug }}
{{ $month := "1" }}
{{ $year := "1" }}
{{ if .Date }}
{{ $split := split .Date "-" }}
{{ $month = index $split 1 }}
{{ $year = index $split 0 }}
{{ end }}
{{ $path := printf "/art/%s/%s/%s" $year $month $filename_without_ext}}
<a href="{{ $path }}" aria-label="Click to view details {{ $year }}" class="no-decoration">
{{ $title := .Title }}
{{ $full := printf "%s/thumb/%s.avif" $.Site.Params.image_host $filename_without_ext }}
{{ $jpeg := printf "%s/thumb/%s.jpg" $.Site.Params.image_host $filename_without_ext }}
<picture>
<source srcset="{{ $full }}" width="{{ math.Div .Params.thumb_width 2 }}" height="{{ math.Div .Params.thumb_height 2 }}" type="image/avif"/>
<img class="gallery-img featured-art" width="{{ math.Div .Params.thumb_width 2 }}" height="{{ math.Div .Params.thumb_height 2 }}" alt="{{ $title }}" src="{{ $jpeg }}">
</picture>
</a>
<figcaption>
{{ with .Title }}
<i>"{{ . }}"</i>
{{ end }}
</figcaption>
</figure>
{{ end }}
</div>
{{ end }}
{{ partial "comments" . }}
{{ end }}