Files
hugo/layouts/research/section.html
T

68 lines
2.1 KiB
HTML

{{ define "title" }}{{ .Title }} - {{ .Site.Title }}{{ end }}
{{ define "content" }}
{{ partial "research/styles.html" . }}
{{- $segments := split (strings.TrimPrefix "/" (strings.TrimSuffix "/" .RelPermalink)) "/" -}}
{{- $depth := len $segments -}}
{{- if eq $depth 1 -}}
{{/* Research root: optional intro (content of _index.md), then data-driven publication list. */}}
{{- with .Content }}<div class="post-content">{{ . }}</div>{{ end -}}
{{- $pubs := hugo.Data.publications.publications -}}
{{- $groups := slice
(dict "type" "phdthesis" "label" "PhD Theses" "prefix" "T")
(dict "type" "journal" "label" "Journal Articles" "prefix" "J")
(dict "type" "conference" "label" "Conference Publications" "prefix" "C")
(dict "type" "lecture" "label" "Lectures" "prefix" "L")
-}}
{{- range $groups -}}
{{- $group := . -}}
{{- $filtered := where $pubs "type" $group.type -}}
{{- $grouped := sort $filtered "year" "desc" -}}
{{- with $grouped -}}
<section class="pub-section">
<h2>{{ $group.label }}</h2>
<div class="pub-list">
{{- $count := len . -}}
{{- range $i, $pub := . -}}
{{- $num := sub $count $i -}}
{{- $prefix := printf "%s%d" $group.prefix $num -}}
{{ partial "research/publication-entry.html" (dict "pub" $pub "prefix" $prefix) }}
{{- end -}}
</div>
</section>
{{- end -}}
{{- end -}}
{{- else if eq $depth 2 -}}
{{/* Paper landing page. */}}
{{ partial "research/paper-body.html" . }}
{{- else -}}
{{/* Nested notebook section (e.g. tikz/_index.md). */}}
<article class="post research-notebook">
<header class="post-header">
<h1 class="post-title">{{ .Title }}</h1>
<div class="post-meta" style="text-align:center;">
<a href="{{ .Parent.RelPermalink }}">← Back to paper</a>
</div>
</header>
{{ partial "research/toc.html" . }}
<div class="post-content">
{{ .Content }}
{{- if .Pages }}
<hr>
<h2>Pages</h2>
<ul>
{{- range .Pages }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{- end }}
</ul>
{{- end }}
</div>
</article>
{{- end -}}
{{ end }}