Allow slides and recordings be linked to talks

This commit is contained in:
Vojtěch Káně 2020-05-21 10:56:05 +02:00
parent 4b4665a855
commit 399e503647
5 changed files with 44 additions and 0 deletions

View File

@ -4,4 +4,8 @@ date: {{ .Date }}
draft: false
authors: [ "unknown" ]
when: {{ .Date }}
slides:
- data: <url>
recordings:
- data: <url>
---

View File

@ -32,6 +32,14 @@ other = "Datum přednášky"
[talks-paginator-heading]
other = "Nadcházející a proběhlé Talky"
[talks-slides]
other = "Prezentace"
[talks-recording]
one = "Záznam"
few = "Záznamy"
other = "Záznamy"
[tags]
other = "Tagy"

View File

@ -27,6 +27,13 @@ other = "Speaker"
[talks-paginator-heading]
other = "Upcoming and past Talks"
[talks-slides]
other = "Slides"
[talks-recording]
one = "Recording"
other = "Recordings"
[tags]
other = "Tags"

View File

@ -0,0 +1,23 @@
{{- range $i, $_ := .content -}}
{{- $type := (default "link" .type) -}}
{{- $desc := .desc -}}
{{- if (eq (len $.content) 1) -}}
{{- $desc = (default $.text $desc) -}}
{{- else -}}
{{- if (and (not (isset . "desc")) (not (eq $type "text"))) -}}{{- errorf "Missing description for content %s" .data -}}{{- end -}}
{{- end -}}
{{- if (and (or (gt (len $.content) 1) (eq $type "text")) (eq $i 0)) -}}{{- $.text -}}:&nbsp{{- end -}}
{{- if (gt $i 0) -}}, {{ end -}}
{{- if (eq $type "link") -}}
<a href="{{ .data }}" target="_blank" rel="noopener">{{ $desc }}</a>
{{- else if (eq $type "text") -}}
{{- .data -}}
{{- else if (eq $type "resource") -}}
{{- $resource := $.resources.GetMatch "fablab-experience.jpg" -}}
<a href="{{ $resource.RelPermalink }}">{{ $desc }}</a>
{{- else -}}
{{- errorf "Unknown content type %s" $type -}}
{{- end -}}
{{- end -}}

View File

@ -5,4 +5,6 @@
<p class="">
{{- T "presenter" -}}: {{ range .Params.authors }}{{ with $.Site.GetPage (printf "authors/%s" .) }}<a class="separateWithCommas" href="{{ .Permalink }}">{{ .Title }}</a>{{ end }}{{ end }}
</p>
{{- with .Params.slides -}}<p>{{ partial "linkedContent" (dict "text" (T "talks-slides" (len .)) "content" . "resources" $.Page.Resources) }}</p>{{- end -}}
{{- with .Params.recordings -}}<p>{{ partial "linkedContent" (dict "text" (T "talks-recording" (len .)) "content" . "resources" $.Page.Resources) }}</p>{{- end -}}
</div>