Use jinja for parameter injection and hugo template for person page #11
2 changed files with 116 additions and 13 deletions
108
layouts/_default/person.html
Normal file
108
layouts/_default/person.html
Normal file
|
|
@ -0,0 +1,108 @@
|
||||||
|
{{ 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 }} {{ .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 }}
|
||||||
|
|
@ -2,17 +2,12 @@
|
||||||
title: {{ given_name }} {{ family_name }}
|
title: {{ given_name }} {{ family_name }}
|
||||||
params:
|
params:
|
||||||
graphRootNodePID: {{ pid }}
|
graphRootNodePID: {{ pid }}
|
||||||
|
{%- set fields = ["given_name", "family_name", "identifiers", "description"] %}
|
||||||
|
{%- set p = {} %}
|
||||||
|
{%- for f in fields %}
|
||||||
|
{%- if f in __rec and __rec[f] %}
|
||||||
|
{%- set _ = p.update({f: __rec[f]}) %}
|
||||||
|
{%- endif %}
|
||||||
|
{%- endfor %}
|
||||||
|
{{ p | toyaml | indent(2) | trim }}
|
||||||
---
|
---
|
||||||
|
|
||||||
{{ description }}
|
|
||||||
|
|
||||||
{%- for identifier in identifiers if identifier.creator.name is defined -%}
|
|
||||||
{%- if description is defined and loop.first %}{{ '\n\n' }}{% endif -%}
|
|
||||||
{% if identifier.creator.name == "Debian" %}- [Debian: {{ identifier.notation }}](https://qa.debian.org/developer.php?login={{ identifier.notation }})
|
|
||||||
{% elif identifier.creator.name == "GitHub" %}- [GitHub: {{ identifier.notation }}](https://github.com/{{ identifier.notation }})
|
|
||||||
{% elif identifier.creator.name == "LinkedIn" %}- [LinkedIn: {{ identifier.notation }}](https://www.linkedin.com/in/{{ identifier.notation }})
|
|
||||||
{% elif identifier.creator.name == "ORCID" %}- [ORCID: {{ identifier.notation }}](https://orcid.org/{{ identifier.notation }})
|
|
||||||
{% elif identifier.creator.name == "ResearchGate" %}- [ResearchGate: {{ identifier.notation }}](https://www.researchgate.net/profile/{{ identifier.notation }})
|
|
||||||
{% else %}- {{ identifier.creator.name }}: {{ identifier.notation }}
|
|
||||||
{% endif %}
|
|
||||||
{%- endfor -%}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue