person-pages update: use params and hugo html template #8
3 changed files with 84 additions and 15 deletions
|
|
@ -40,6 +40,6 @@ jobs:
|
||||||
dtc get-records ${DUMPTHINGS_APIURL} public -C XYZPerson \
|
dtc get-records ${DUMPTHINGS_APIURL} public -C XYZPerson \
|
||||||
| qri filter-linked-pid public xyzrins:. associated_with \
|
| qri filter-linked-pid public xyzrins:. associated_with \
|
||||||
| qri inline-records -c public -p delegated_by -p delegated_by::roles -p identifiers::creator \
|
| qri inline-records -c public -p delegated_by -p delegated_by::roles -p identifiers::creator \
|
||||||
| qri render-record page_templates/person.md.j2 'content/{__pid_curie_reference}/_index.md'
|
| qri render-record --include-data-at-key param_context page_templates/person.md.j2 'content/{__pid_curie_reference}/_index.md'
|
||||||
- name: Deposit changes
|
- name: Deposit changes
|
||||||
uses: ./.forgejo/actions/deposit-changes
|
uses: ./.forgejo/actions/deposit-changes
|
||||||
|
|
|
||||||
73
layouts/_default/person.html
Normal file
73
layouts/_default/person.html
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
{{ define "main" }}
|
||||||
|
<article class="prose dark:prose-invert">
|
||||||
|
<header>
|
||||||
|
<h1 class="mt-0 text-4xl font-extrabold text-neutral-900 dark:text-neutral">{{ .Params.given_name }} {{ .Params.family_name }}</h1>
|
||||||
|
</header>
|
||||||
|
<!-- Portrait depiction -->
|
||||||
|
{{ $portraits := .Resources.Match "portrait.*" }}
|
||||||
|
{{ with index $portraits 0 }}
|
||||||
|
<img src="{{ .RelPermalink }}" alt="Portrait of {{ $.Params.given_name }} {{ $.Params.family_name }}">
|
||||||
|
{{ end }}
|
||||||
|
<!-- 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 }}
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
---
|
---
|
||||||
title: {{ given_name }} {{ family_name }}
|
title: {{ given_name }} {{ family_name }}
|
||||||
---
|
params:
|
||||||
|
{%- set fields = ["given_name", "family_name", "identifiers", "description"] %}
|
||||||
{{ description }}
|
{%- set p = {} %}
|
||||||
|
{%- for f in fields %}
|
||||||
{%- for identifier in identifiers if identifier.creator.name is defined -%}
|
{%- if f in param_context and param_context[f] %}
|
||||||
{%- if description is defined and loop.first %}{{ '\n\n' }}{% endif -%}
|
{%- set _ = p.update({f: param_context[f]}) %}
|
||||||
{% if identifier.creator.name == "Debian" %}- [Debian: {{ identifier.notation }}](https://qa.debian.org/developer.php?login={{ identifier.notation }})
|
{%- endif %}
|
||||||
{% elif identifier.creator.name == "GitHub" %}- [GitHub: {{ identifier.notation }}](https://github.com/{{ identifier.notation }})
|
{%- endfor %}
|
||||||
{% elif identifier.creator.name == "LinkedIn" %}- [LinkedIn: {{ identifier.notation }}](https://www.linkedin.com/in/{{ identifier.notation }})
|
{{ p | toyaml | indent(2) | trim }}
|
||||||
{% 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