Creator links, improved author listings

This commit is contained in:
Madison Rye Progress
2026-03-12 18:20:15 -07:00
parent af0c10fe5d
commit 59038f7562
4 changed files with 60 additions and 18 deletions

View File

@ -4,7 +4,16 @@
<dl>
{{- range $work := sort (where (where $works "collection" nil) "parent" nil) "title" "asc" }}
<dt><a href="{{ $work.url }}">{{ $work.title }}</a> <span class="author">by {{ delimit $work.authors ", " }}</span></dt>
<dt><a href="{{ $work.url }}">{{ $work.title }}</a> <span class="author">by
{{ range $k, $author := $work.authors }}
{{- if index hugo.Data.creators $author }}<a href="{{ index hugo.Data.creators $author }}" target="_blank">{{ $author | markdownify }}</a>{{ else }}{{ $author | markdownify }}{{ end }}
{{- if ne (add $k 1) ($work.authors | len) }}, {{ end }}
{{- end }}
{{- range $contributor := $work.contributors }},
{{ if index hugo.Data.creators $contributor }}<a href="{{ index hugo.Data.creators $contributor }}" target="_blank">{{ $contributor | markdownify }}</a>{{ else }}{{ $contributor | markdownify }}{{ end }}
<small>(contributor)</small>
{{- end }}
</span></dt>
<dd>
{{ $work.description | markdownify }}
<ul class="meta">
@ -22,7 +31,16 @@
<h3>Associated works</h3>
<dl>
{{- range $subwork := where $works "parent" "eq" $work.title }}
<dt><a href="{{ $subwork.url }}">{{ $subwork.title }}</a> <span class="author">by {{ delimit $subwork.authors ", " }}</span></dt>
<dt><a href="{{ $subwork.url }}">{{ $subwork.title }}</a> <span class="author">by
{{ range $k, $author := $subwork.authors }}
{{- if index hugo.Data.creators $author }}<a href="{{ index hugo.Data.creators $author }}" target="_blank">{{ $author | markdownify }}</a>{{ else }}{{ $author | markdownify }}{{ end }}
{{- if ne (add $k 1) ($work.authors | len) }}, {{ end }}
{{- end }}
{{- range $contributor := $subwork.contributors }},
{{ if index hugo.Data.creators $contributor }}<a href="{{ index hugo.Data.creators $contributor }}" target="_blank">{{ $contributor | markdownify }}</a>{{ else }}{{ $contributor | markdownify }}{{ end }}
<small>(contributor)</small>
{{- end }}
</span></dt>
<dd>
{{ $subwork.description | markdownify }}
<ul class="meta">
@ -48,16 +66,25 @@
<dl>
{{- range $work := where $works "collection" $collection.id }}
<dt><a href="{{ $work.url }}">{{ $work.title }}</a> <span class="author">by {{ delimit $work.authors ", " }}</span></dt>
<dt><a href="{{ $work.url }}">{{ $work.title }}</a> <span class="author">by
{{ range $k, $author := $work.authors }}
{{- if index hugo.Data.creators $author }}<a href="{{ index hugo.Data.creators $author }}" target="_blank">{{ $author | markdownify }}</a>{{ else }}{{ $author | markdownify }}{{ end }}
{{- if ne (add $k 1) ($work.authors | len) }}, {{ end }}
{{- end }}
{{- range $contributor := $work.contributors }},
{{ if index hugo.Data.creators $contributor }}<a href="{{ index hugo.Data.creators $contributor }}" target="_blank">{{ $contributor | markdownify }}</a>{{ else }}{{ $contributor | markdownify }}{{ end }}
<small>(contributor)</small>
{{- end }}
</span></dt>
<dd>
{{ $work.description | markdownify }}
<ul class="meta">
<li><em>Type:</em> {{ $work.type }}</li>
<li><em>Characters and dates:</em> <ul>
<li><em>Characters and dates:</em>
{{- range $k, $v := $work.years }}
<li>{{ index $work.characters $k }} — {{ $v }}</li>
{{- end }}
</ul></li>
{{ index $work.characters $k }} — {{ $v }}
{{- if ne (add $k 1) ($work.years | len) }}, {{- end }}
{{- end }}</li>
{{- if $work.cw }}<li><em>CWs:</em> {{ $work.cw }}</li>{{- end }}
{{- if $work.spoilers }}<li><em>Spoilers:</em> {{ $work.spoilers | markdownify }}</li>{{- end }}
</ul>
@ -66,7 +93,16 @@
<h3>Associated works</h3>
<dl>
{{- range $subwork := where $works "parent" "eq" $work.title }}
<dt><a href="{{ $subwork.url }}">{{ $subwork.title }}</a> <span class="author">by {{ delimit $subwork.authors ", " }}</span></dt>
<dt><a href="{{ $subwork.url }}">{{ $subwork.title }}</a> <span class="author">by
{{ range $k, $author := $subwork.authors }}
{{- if index hugo.Data.creators $author }}<a href="{{ index hugo.Data.creators $author }}" target="_blank">{{ $author | markdownify }}</a>{{ else }}{{ $author | markdownify }}{{ end }}
{{- if ne (add $k 1) ($work.authors | len) }}, {{ end }}
{{- end }}
{{- range $contributor := $subwork.contributors }},
{{ if index hugo.Data.creators $contributor }}<a href="{{ index hugo.Data.creators $contributor }}" target="_blank">{{ $contributor | markdownify }}</a>{{ else }}{{ $contributor | markdownify }}{{ end }}
<small>(contributor)</small>
{{- end }}
</span></dt>
<dd>
{{ $subwork.description | markdownify }}
<ul class="meta">
@ -90,6 +126,3 @@
</section>
{{- end }}
<style>
</style>