Skip to content

Commit 724aecd

Browse files
authored
Merge pull request #28 from pythonsul/add-apyb-logo
feat: add APYB logo as suporter [#27]
2 parents b75c268 + 5dd70ce commit 724aecd

File tree

9 files changed

+60
-16
lines changed

9 files changed

+60
-16
lines changed

content/data/section/sponsors.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,27 @@
5959
{
6060
"name": "Cumbuca Dev",
6161
"url": "https://cumbuca.dev/",
62-
"logo": "https://cumbuca.dev/wp-content/uploads/2024/08/site-logo.png?w=60&h=60",
62+
"logo": "/images/sponsors/cumbuca.png",
6363
"alt": {
6464
"pt-br": "Logo da Cumbuca Dev",
6565
"en": "Cumbuca Dev Logo",
6666
"es": "Logo de Cumbuca Dev"
6767
}
6868
},
69+
{
70+
"name": "APYB",
71+
"url": "https://apyb.python.org.br",
72+
"logo": "/images/sponsors/apyb.png",
73+
"alt": {
74+
"pt-br": "Logo da APYB - Associação Python Brasil",
75+
"en": "APYB Logo",
76+
"es": "Logo de APYB"
77+
}
78+
},
6979
{
7080
"name": "GDG - Porto Alegre",
7181
"url": "https://gdg.community.dev/gdg-porto-alegre/",
72-
"logo": "https://sul.python.org.br/images/gdg-poa.png",
82+
"logo": "/images/sponsors/gdg-poa.png",
7383
"alt": {
7484
"pt-br": "Logo do GDG - Porto Alegre",
7585
"en": "Logo of GDG - Porto Alegre",
@@ -79,7 +89,7 @@
7989
{
8090
"name": "Canal Roveeb",
8191
"url": "https://roveeb.com/",
82-
"logo": "https://sul.python.org.br/images/logo-roveeb.png",
92+
"logo": "/images/sponsors/roveeb.png",
8393
"alt": {
8494
"pt-br": "Logo do Canal Roveeb - Lajeado - RS",
8595
"en": "Logo of Canal Roveeb - Lajeado - RS",
@@ -89,12 +99,12 @@
8999
{
90100
"name": "PHPRS",
91101
"url": "https://github.com/PHPRS",
92-
"logo": "https://sul.python.org.br/images/phprs.jpg",
102+
"logo": "/images/sponsors/phprs.jpg",
93103
"alt": {
94104
"pt-br": "Logo da PHPRS",
95105
"en": "PHPRS Logo",
96106
"es": "Logo de PHPRS"
97107
}
98108
}
99109
]
100-
}
110+
}

content/images/sponsors/apyb.png

15.9 KB
Loading
4.41 KB
Loading
File renamed without changes.

content/images/sponsors/phprs.jpg

54.9 KB
Loading
File renamed without changes.

src/assets/scss/sections/_supporters.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,24 @@
3535
&.canal-roveeb {
3636
background-color: $black;
3737
}
38+
39+
&.apyb {
40+
img {
41+
height: $space-5;
42+
}
43+
}
44+
}
45+
46+
figure {
47+
margin: 0;
48+
@include flex-center;
49+
50+
picture {
51+
@include flex-center;
52+
}
53+
}
54+
55+
figcaption {
56+
display: none;
3857
}
3958
}

src/layouts/_partials/core/image.html

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{{ $className := .className | default "" }}
55
{{ $isAvatar := isset . "avatar" }}
66
{{ $image := resources.Get $sourcePath }}
7-
{{ $image := $image | default (resources.Get "/images/placeholder.png") }}
7+
{{ $image = $image | default (resources.Get "/images/placeholder.png") }}
88

99
{{/* Set responsive image sizes based on avatar flag */}}
1010
{{ $sizeSmall := cond $isAvatar "32x" "600x" }}
@@ -13,30 +13,43 @@
1313
{{ $sizeFull := cond $isAvatar "128x" "1400x" }}
1414

1515
{{ with $image }}
16-
{{/* Generate resized images in WebP and JPEG formats */}}
16+
{{/* Determine original image format (prefer resource MediaType, fall back to path extension) */}}
17+
{{ $extFromPath := lower (strings.TrimPrefix "." (path.Ext $sourcePath)) }}
18+
{{ $origFormat := (.MediaType.SubType | default $extFromPath) | lower }}
19+
{{ $isPNG := or (eq $origFormat "png") (eq $origFormat "x-png") }}
20+
21+
{{/* Generate resized images in WebP and original/fallback formats */}}
1722
{{ $webpSmall := .Resize (printf "%s webp q80" $sizeSmall) }}
1823
{{ $webpMedium := .Resize (printf "%s webp q80" $sizeMedium) }}
1924
{{ $webpLarge := .Resize (printf "%s webp q80" $sizeLarge) }}
20-
{{ $jpegFull := .Resize (printf "%s jpg q90" $sizeFull) }}
25+
26+
{{ $fallbackConfig := cond $isPNG (dict "format" "png" "mime" "image/png") (dict "format" "jpg q90" "mime" "image/jpeg") }}
27+
{{ $fallback := .Resize (printf "%s %s" $sizeFull (index $fallbackConfig "format")) }}
28+
{{ $mimeFallback := index $fallbackConfig "mime" }}
29+
{{ $sizesAttr := cond $isAvatar "(min-width: 1024px) 128px, (min-width: 800px) 64px, 32px" "(min-width: 1024px) 1400px, (min-width: 800px) 1000px, 600px" }}
2130

2231
<figure class="{{ $className }}">
2332
<picture>
24-
{{/* JPEG fallback for large screens */}}
25-
<source srcset="{{ $jpegFull.Permalink }}" type="image/jpeg" media="(min-width: 1024px)">
26-
{{/* WebP for large, medium, and small screens */}}
33+
{{/* WebP sources for modern browsers */}}
2734
<source srcset="{{ $webpLarge.Permalink }}" type="image/webp" media="(min-width: 1024px)">
2835
<source srcset="{{ $webpMedium.Permalink }}" type="image/webp" media="(max-width: 1024px)">
2936
<source srcset="{{ $webpSmall.Permalink }}" type="image/webp" media="(max-width: 800px)">
37+
38+
{{/* Fallback for large screens in original format (PNG or JPEG) */}}
39+
<source srcset="{{ $fallback.Permalink }}" type="{{ $mimeFallback }}" media="(min-width: 1024px)">
40+
3041
{{/* Fallback img tag with alt text and lazy loading */}}
3142
<img
32-
src="{{ $jpegFull.Permalink }}"
43+
src="{{ $fallback.Permalink }}"
3344
alt="{{ $alt | plainify }}"
34-
width="{{ $jpegFull.Width }}"
35-
height="{{ $jpegFull.Height }}"
45+
width="{{ $fallback.Width }}"
46+
height="{{ $fallback.Height }}"
47+
sizes="{{ $sizesAttr }}"
3648
loading="lazy"
3749
decoding="async"
38-
/>
50+
/>
3951
</picture>
52+
4053
{{/* Show figcaption if alt is set and not an avatar */}}
4154
{{ if and $alt (not $isAvatar) }}
4255
<figcaption>CC: {{ $alt }}</figcaption>

src/layouts/_partials/sections/supporters.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{ $supporters := .Site.Data.section.sponsors.supporters }}
2+
{{ $currentLang := .Site.Language.Lang }}
23

34
<section class="sponsors" id="sponsors">
45
<div class="section-container">
@@ -14,7 +15,8 @@ <h2 class="section-title">
1415
{{ range $supporters }}
1516
<div class="supporter-logo {{ .name | urlize }}">
1617
<a href="{{ .url }}" target="_blank" rel="noopener noreferrer">
17-
<img src="{{ .logo }}" alt="{{ .name }} Logo" />
18+
{{ $alt := index .alt $currentLang }}
19+
{{ partial "core/image.html" (dict "src" .logo "alt" $alt ) }}
1820
</a>
1921
</div>
2022
{{ end }}

0 commit comments

Comments
 (0)