Skip to content
Snippets Groups Projects
single.html 2.84 KiB
{{ define "main" }}
  {{- $slug := .Slug -}}
  {{- $programsForTeacher := slice -}}
  {{ if isset site.Taxonomies "teachers" -}}
    {{ $programsForTeacher = index site.Taxonomies.teachers $slug}}
  {{- end }}
  {{- $programsForAdministrator := slice -}}
  {{ if isset site.Taxonomies "administrators" -}}
    {{ $programsForAdministrator = index site.Taxonomies.administrators $slug}}
  {{- end }}

  {{ $author := site.GetPage (printf "/authors/%s" $slug) }}
  {{ $researcher := site.GetPage (printf "/researchers/%s" $slug) }}

  {{ $posts := where $author.Pages "Section" "posts" }}
  {{ $publications := where $researcher.Pages "Section" "publications" }}
  {{ $papers := where $author.Pages "Section" "papers" }}

  {{ partial "persons/hero-single.html" . }}

  <div class="document-content">
    {{ partial "toc/container.html"
        (dict
            "toc" "toc/default.html"
            "context" .
        )
    }}
    <div itemscope itemtype="https://schema.org/Person" class="container">
      <meta itemprop="name" content="{{ partial "PrepareHTML" .Title }}">
      <meta itemprop="url" content="{{ .Permalink }}">
      {{- if .Params.image -}}
        {{- $image := partial "GetMedia" .Params.image -}}
        {{- if $image -}}
          <meta itemprop="image" content="{{ $image.url }}">
        {{- end -}}
      {{- end -}}

      <div class="informations">
        <div>
          {{ partial "persons/summary.html" (dict
            "context" .
          ) }}
          {{ if (partial "GetTextFromHTML" .Content) }}
            <div class="rich-text">
              {{ partial "PrepareHTML" .Content }}
            </div>
          {{ end }}
        </div>
        {{ range $programsForAdministrator }}
        {{ $program := . }}
          <div class="roles">
            {{ range .Params.roles }}
              {{ $role := .title }}
              {{ if in .persons $slug }}
                <p>
                  {{ safeHTML $role }}<br>
                  <a href="{{ $program.Permalink }}" class="link">{{ safeHTML $program.Title }}</a>
                </p>
              {{ end }}
            {{ end }}
          </div>
        {{ end }}
      </div>

      {{ partial "persons/contact-details.html" . }}

    </div>

    {{ partial "contents/list.html" . }}
    <div class="container person-objects">
      {{ if $programsForTeacher }}
        {{ partial "persons/programs.html" (dict "programs" $programsForTeacher "slug" $slug) }}
      {{ end }}

      {{ if $publications }}
        {{ partial "persons/publications.html" (dict "publications" $publications "researcher" $researcher) }}
      {{ end }}

      {{ if $posts }}
        {{ partial "persons/posts.html" (dict "posts" $posts "author" $author) }}
      {{ end }}

      {{ if $papers }}
        {{ partial "persons/papers.html" (dict "papers" $papers "slug" $slug) }}
      {{ end }}
    </div>
  </div>
{{ end }}