www-from-model/layouts/_default/person.html
Stephan Heunis bedbe5733c
All checks were successful
Deploy on webserver / Build site and deploy on success (push) Successful in 1m15s
Use jinja for parameter injection and hugo template for person page
This uses the new '__rec' property of 'query-things' 'render_record' command
to extract values for explicitly defined keys and inject them under 'params'
in the markdown page front matter. This makes them available to a hugo
template under '.Params'.

A new 'layouts/_default/person.html' template is now responsible for rendering
everything on a person page. This allows using hugo's bundle resources to easily
check e.g. if there is a portrait of the person in the bundle. The template
renders everything that was previously rendered from the _index.md page, and will
put the portrait and graph side by side if a portrait exists, otherwise the graph
will display full-width. A snippet from the congo theme is included at the end of
the template in order to render all taxonomy related terms.
2026-03-19 16:17:32 +01:00

108 lines
No EOL
3.7 KiB
HTML

{{ define "main" }}
<header>
{{ if .Params.showBreadcrumbs | default (.Site.Params.list.showBreadcrumbs | default false) }}
{{ partial "breadcrumbs.html" . }}
{{ end }}
{{ if and .Params.given_name .Params.family_name }}
<h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .Params.given_name }}&nbsp;{{ .Params.family_name }}</h1>
{{ else }}
<h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .Title }}</h1>
{{ end }}
</header>
<article class="prose max-w-full dark:prose-invert">
<!-- Portrait depiction and Graph -->
{{ $portraits := .Resources.Match "portrait.*" }}
{{ $hasPortrait := gt (len $portraits) 0 }}
<table class="not-prose w-full">
<tr>
{{ if $hasPortrait }}
<td width="30%" class="align-middle text-center">
{{ with index $portraits 0 }}
<img src="{{ .RelPermalink }}" alt="Portrait of {{ $.Params.given_name }} {{ $.Params.family_name }}">
{{ end }}
</td>
{{ end }}
<td class="align-middle text-center">
{{ if .Param "graphRootNodePID" | default false }}
<div class="prose max-w-full dark:prose-invert">
<script>
const limitGraphRootNodeId = '{{ .Param "graphRootNodePID" }}';
</script>
<script type="module" crossorigin src="/graph.js"></script>
<div class="relative">
{{ if .Param "graphDescription" | default false }}
<p>{{ .Param "graphDescription" }}</p>
{{ end }}
<div id="sigma-node-type-controls" class="absolute z-10 left-2 bottom-2" >
<div id="sigma-controls-list" ></div>
</div>
<div id="sigma-container" class="w-full h-[40vh] m-0 p-0 bg-neutral-100 dark:bg-neutral-600" ></div>
</div>
</div>
{{ end }}
</td>
</tr>
</table>
<!-- Description -->
{{ with .Params.description }}
<p>{{ . }}</p>
{{ end }}
<!-- Identifiers -->
{{ $links := dict
"Debian" "https://qa.debian.org/developer.php?login=%s"
"GitHub" "https://github.com/%s"
"LinkedIn" "https://www.linkedin.com/in/%s"
"ORCID" "https://orcid.org/%s"
"ResearchGate" "https://www.researchgate.net/profile/%s"
}}
{{ with .Params.identifiers }}
<ul>
{{ range . }}
{{ $notation := .notation }}
{{ $name := "" }}
{{ if reflect.IsMap .creator }}
{{ $name = index .creator "name" }}
{{ else }}
{{ $name = .creator }}
{{ end }}
<li>
{{ if and $name (isset $links $name) }}
<a href="{{ printf (index $links $name) $notation }}">
{{ $name }}: {{ $notation }}
</a>
{{ else }}
{{ $name }}: {{ $notation }}
{{ end }}
</li>
{{ end }}
</ul>
{{ end }}
</article>
{{ if .Data.Pages }}
<br>
<section>
{{ if $.Params.groupByYear | default ($.Site.Params.list.groupByYear | default true) }}
{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }}
<h2 class="mt-12 text-2xl font-bold text-neutral-700 first:mt-8 dark:text-neutral-300">
{{ .Key }}
</h2>
<hr class="w-36 border-dotted border-neutral-400" />
{{ range .Pages }}
{{ partial "article-link.html" . }}
{{ end }}
{{ end }}
{{ else }}
{{ range (.Paginate .Pages).Pages }}
{{ partial "article-link.html" . }}
{{ end }}
{{ end }}
</section>
{{ partial "pagination.html" . }}
{{ else }}
<section class="prose mt-10 dark:prose-invert">
<p class="border-t py-8">
<em>{{ i18n "list.no_articles" | emojify }}</em>
</p>
</section>
{{ end }}
{{ end }}