Skip to content

Commit 6363ee1

Browse files
Grzegorz Kocjangkocjan
Grzegorz Kocjan
authored andcommitted
Generate meetup in a dynamic way for better content handling
1 parent 37febbd commit 6363ee1

File tree

13 files changed

+191
-27
lines changed

13 files changed

+191
-27
lines changed

Diff for: assets/css/custom.css

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* limits Table of Content item length */
2+
nav#TableOfContents ul li a {
3+
display: inline-block;
4+
max-width: 20ch;
5+
overflow: hidden;
6+
text-overflow: ellipsis;
7+
white-space: nowrap;
8+
vertical-align: bottom;
9+
}
Loading

Diff for: assets/images/infographic_template_solo.png

803 KB
Loading

Diff for: config/_default/params.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ disableTextInHeader = false
2626

2727
highlightCurrentMenuArea = true
2828
smartTOC = true
29-
smartTOCHideUnfocusedChildren = true
29+
smartTOCHideUnfocusedChildren = false
3030

3131
giteaDefaultServer = "https://git.fsfe.org"
3232
forgejoDefaultServer = "https://v8.next.forgejo.org"
@@ -72,7 +72,7 @@ forgejoDefaultServer = "https://v8.next.forgejo.org"
7272
seriesOpened = false
7373
showHeadingAnchors = true
7474
showPagination = true
75-
invertPagination = false
75+
invertPagination = true
7676
showReadingTime = false
7777
showTableOfContents = true
7878
# showRelatedContent = false

Diff for: content/spotkania/_content.gotmpl

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{{ range $meetup_number, $meetup := site.Data.meetups }}
2+
3+
{{ $time := .Site.Params.dateParse "2006-01-02" $meetup.date }}
4+
5+
{{ $contentValue := printf `
6+
## Informacje
7+
8+
**📅 data:** %s</br>
9+
**🕕 godzina:** %s</br>
10+
**📍 miejsce:** %s</br>`
11+
$meetup.date $meetup.time $meetup.place
12+
}}
13+
14+
{{ if $meetup.live_stream }}
15+
{{ $liveLink := printf "{{< youtubeLite id=\"%s\" label=\"%s\" >}}" $meetup.live_stream "Label" }}
16+
{{ $contentValue = printf "%s \n ## Live Stream \n %s" $contentValue $liveLink }}
17+
{{ end }}
18+
19+
{{ $contentValue := printf "%s \n ## Prelekcje" $contentValue}}
20+
21+
{{ range $meetup.talks }}
22+
{{ $cleanedTitle := replace (replace .talk_title "\n" " ") "\t" " " }}
23+
{{ $cleanedTitle = replaceRE `\s+` " " $cleanedTitle }}
24+
{{ $contentValue = printf "%s \n ### %s" $contentValue $cleanedTitle }}
25+
{{ $contentValue = printf "%s \n %s" $contentValue (printf "{{< speaker speaker_id=\"%s\" >}}" .speaker_id) }}
26+
{{ if .talk_description }}
27+
{{ $contentValue = printf "%s \n %s" $contentValue .talk_description }}
28+
{{ end }}
29+
{{ end }}
30+
31+
{{ $contentValue = printf "%s \n ## Sponsorzy" $contentValue }}
32+
{{ range $meetup.sponsors }}
33+
{{ $contentValue = printf "%s \n %s </br>" $contentValue (printf "{{< article link=\"/sponsorzy/%s/\" >}}" .) }}
34+
{{ end }}
35+
36+
{{/* Add page. */}}
37+
{{ $content := dict "mediaType" "text/markdown" "value" $contentValue }}
38+
{{ $params := dict "talks" $meetup.talks }}
39+
40+
{{ $dates := dict "date" (time.AsTime $meetup.date) }}
41+
{{ $page := dict
42+
"content" $content
43+
"dates" $dates
44+
"time" $meetup.time
45+
"place" $meetup.place
46+
"params" $params
47+
"path" $meetup_number
48+
"title" $meetup.title
49+
}}
50+
{{ $.AddPage $page }}
51+
52+
{{/* Add featured image. */}}
53+
{{ $info_graphic := ""}}
54+
{{ if eq (len $meetup.talks) 1 }}
55+
{{- $info_graphic = partial "infographic-image-solo.html" (dict "meetup" $meetup) -}}
56+
{{ end }}
57+
{{ if eq (len $meetup.talks) 2 }}
58+
{{- $info_graphic = partial "infographic-image-duo.html" (dict "meetup" $meetup) -}}
59+
{{ end }}
60+
61+
{{ $content := dict
62+
"mediaType" $info_graphic.MediaType.Type
63+
"value" $info_graphic
64+
}}
65+
{{ $resource := dict
66+
"content" $content
67+
"path" (printf "%s/featured.png" $meetup_number)
68+
}}
69+
{{ $.AddResource $resource }}
70+
71+
72+
73+
{{ end }}

Diff for: content/spotkania/_index.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
---
3+
title: Spotkania
4+
orderByWeight: false
5+
---

Diff for: content/spotkania/55.md renamed to data/meetups/55.yaml

-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
title: "Meetup #55"
32
date: 2024-11-27
43
time: "18:00"
@@ -18,8 +17,3 @@ talks:
1817
talk_description: "W tej prezentacji omówimy różnice między standardowym loggerem a Loguru, pokażemy, jak efektywnie wykorzystać ustrukturyzowane logi w projekcie oraz podkreślimy znaczenie logów w procesie tworzenia oprogramowania dla zapewnienia wysokiej jakości i niezawodności aplikacji."
1918
language: "pl"
2019
youtube: "xA6o40uxuso"
21-
22-
---
23-
24-
{{< meetup-details >}}
25-

Diff for: content/spotkania/56.md renamed to data/meetups/56.yaml

-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
title: "Meetup #56"
32
date: 2025-01-29
43
time: "18:00"
@@ -11,7 +10,4 @@ talks:
1110
talk_title: "Nowość w Pythonie 3.14 oraz PyScript"
1211
language: "pl"
1312
youtube: "9POijqwrHuw"
14-
---
15-
16-
{{< meetup-details >}}
1713

Diff for: content/spotkania/57.md renamed to data/meetups/57.yaml

-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
title: "Meetup #57"
32
date: 2025-03-26
43
time: "18:00"
@@ -36,7 +35,3 @@ talks:
3635
talk_title: "Detektyw w świecie Pythona"
3736
talk_description: "Wcielimy się w rolę detektywów, którzy z użyciem narzędzi do profilowania odkryją tajemnice tych narzędzi. Opowiem czym są takie narzędzia oraz jak działają. Dodatkowo wspólnie przejdziemy przez różne codebase-y, na których pokaże jak korzystać z tych narzędzi aby efektywnie rozwiązać problem z wydajnością i przyspieszyć działanie naszego kodu. Wszystkie osoby zainteresowane optymalizacją aplikacji i rozwiązywaniem problemów z wydajnością są mile widziane!"
3837
language: "pl"
39-
40-
---
41-
42-
{{< meetup-details >}}

Diff for: data/speakers/sebastian-buczynski.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,5 @@ bio: "W branży od 12 lat z doświadczeniami lidera technicznego i architekta. T
44
social: [
55
{ facebook: "https://www.facebook.com/sebastian.buczynski.tsn" },
66
{ linkedin: "https://www.linkedin.com/in/sebastianbuczynski" },
7-
{ link: "https://michalmoroz.com/" },
8-
{ link: "https://makimo.com/" }
97
]
108

Diff for: layouts/partials/infographic-image.html renamed to layouts/partials/infographic-image-duo.html

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{{ $fontNormal := resources.Get "fonts/OpenSans-Medium.ttf" }}
22
{{ $fontBold := resources.Get "fonts/OpenSans-Bold.ttf" }}
33

4-
{{ $bg := resources.Get "images/infographic_template.png" }}
4+
{{ $meetup := .meetup }}
5+
6+
{{ $bg := resources.Get "images/infographic_template_duo.png" }}
57
{{ $final := $bg }}
68

9+
710
{{ $imgWidth := $final.Width }}
8-
{{ $date := (printf "%sr. godz. %s" (.Page.Params.date | time.Format "Monday 02.01.2006"| strings.ToUpper) .Page.Params.time) }}
11+
{{ $date := (printf "%sr. godz. %s" ($meetup.date | time.Format "Monday 02.01.2006"| strings.ToUpper) $meetup.time) }}
912
{{ $mainDateOptions := dict
1013
"color" "#393f5f"
1114
"size" 80
@@ -19,13 +22,13 @@
1922
{{ $bottomDateOptions := dict
2023
"color" "#393f5f"
2124
"size" 32
22-
"x" 126.6
25+
"x" 157
2326
"y" 1010.3
2427
"font" $fontNormal
2528
}}
2629
{{ $final = $final.Filter (images.Text $date $bottomDateOptions) }}
2730

28-
{{ $talk1 := index .Page.Params.talks 0}}
31+
{{ $talk1 := index $meetup.talks 0}}
2932

3033
{{ $speaker1 := index site.Data.speakers $talk1.speaker_id }}
3134
{{ $author1Options := dict
@@ -56,7 +59,7 @@
5659
{{ $final := $final.Filter (images.Overlay $maskedSpeaker1 122 490) }}
5760

5861
{{ $final := $final.Filter (images.Overlay $maskedSpeaker1 1537 585) }}
59-
{{ $talk2 := index .Page.Params.talks 1}}
62+
{{ $talk2 := index $meetup.talks 1}}
6063

6164
{{ $speaker2 := index site.Data.speakers $talk2.speaker_id }}
6265
{{ $author1Options := dict
@@ -79,8 +82,6 @@
7982
}}
8083
{{ $final = $final.Filter (images.Text $talk2.talk_title $title2Options) }}
8184

82-
83-
8485
{{ $speaker2Img := resources.Get $speaker2.avatar }}
8586
{{ $speaker2 := $speaker2Img.Fill "240x240 center" }}
8687

@@ -89,4 +90,4 @@
8990
{{ $final := $final.Filter (images.Overlay $maskedSpeaker2 1537 585) }}
9091

9192

92-
{{ return $final.RelPermalink }}
93+
{{ return $final }}

Diff for: layouts/partials/infographic-image-solo.html

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{{ $fontNormal := resources.Get "fonts/OpenSans-Medium.ttf" }}
2+
{{ $fontBold := resources.Get "fonts/OpenSans-Bold.ttf" }}
3+
4+
{{ $meetup := .meetup }}
5+
6+
7+
{{ $bg := resources.Get "images/infographic_template_solo.png" }}
8+
9+
10+
{{ $final := $bg }}
11+
12+
13+
{{ $imgWidth := $final.Width }}
14+
{{ $date := (printf "%sr. godz. %s" ($meetup.date | time.Format "Monday 02.01.2006"| strings.ToUpper) $meetup.time) }}
15+
{{ $mainDateOptions := dict
16+
"color" "#393f5f"
17+
"size" 80
18+
"x" (div $imgWidth 2)
19+
"y" 267.5
20+
"font" $fontNormal
21+
"alignx" "center"
22+
}}
23+
{{ $final = $final.Filter (images.Text $date $mainDateOptions) }}
24+
25+
{{ $bottomDateOptions := dict
26+
"color" "#393f5f"
27+
"size" 32
28+
"x" 157
29+
"y" 1010.3
30+
"font" $fontNormal
31+
}}
32+
{{ $final = $final.Filter (images.Text $date $bottomDateOptions) }}
33+
34+
{{ $talk1 := index $meetup.talks 0}}
35+
36+
{{ $speaker1 := index site.Data.speakers $talk1.speaker_id }}
37+
{{ $author1Options := dict
38+
"color" "#393f5f"
39+
"size" 32
40+
"x" (div $imgWidth 2)
41+
"y" 815
42+
"font" $fontNormal
43+
"alignx" "center"
44+
}}
45+
{{ $final = $final.Filter (images.Text $speaker1.name $author1Options) }}
46+
47+
{{ $title1Options := dict
48+
"color" "#393f5f"
49+
"size" 32
50+
"x" (div $imgWidth 2)
51+
"y" 870
52+
"font" $fontBold
53+
"alignx" "center"
54+
}}
55+
{{ $final = $final.Filter (images.Text $talk1.talk_title $title1Options) }}
56+
57+
{{ $avatarMaskFilter := images.Mask (resources.Get "images/avatars/mask.png") }}
58+
59+
{{ $speaker1Img := resources.Get $speaker1.avatar }}
60+
{{ $speaker1 := $speaker1Img.Fill "300x300 center" }}
61+
62+
{{ $maskedSpeaker1 := $speaker1 | images.Filter $avatarMaskFilter }}
63+
64+
{{ $final := $final.Filter (images.Overlay $maskedSpeaker1 (sub (div $imgWidth 2) 150) 465) }}
65+
66+
67+
{{ return $final }}

Diff for: layouts/shortcodes/speaker.html

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- $speaker_id := .Get "speaker_id" -}}
2+
3+
{{ $speaker := index site.Data.speakers $speaker_id }}
4+
{{ $speakerAvatar := resources.Get $speaker.avatar }}
5+
6+
<div class="flex items-center space-x-3 mt-2">
7+
<img src="{{ $speakerAvatar.Permalink }}" alt="{{ $speaker.name }}" class="w-24 h-24 rounded-full object-cover" >
8+
<div>
9+
<p class="text-sm text-gray-500">Prelegent: <strong>{{ $speaker.name }}</strong></p>
10+
11+
<div class="flex flex-wrap text-neutral-400 dark:text-neutral-500">
12+
{{ range $links := $speaker.social }}
13+
{{ range $name, $url := $links }}
14+
<a
15+
class="px-1 hover:text-primary-700 dark:hover:text-primary-400"
16+
href="{{ $url | safeURL }}"
17+
target="_blank"
18+
aria-label="{{ $name | title }}"
19+
rel="me noopener noreferrer"
20+
><span class="inline-block align-text-bottom">{{ partial "icon.html" $name }}</span></a
21+
>
22+
{{ end }}
23+
{{ end }}
24+
</div>
25+
</div>
26+
</div>

0 commit comments

Comments
 (0)