Skip to content

Commit 12988c8

Browse files
committed
Make better default gsoc banners
1 parent 4f51d24 commit 12988c8

File tree

3 files changed

+129
-1
lines changed

3 files changed

+129
-1
lines changed

_includes/blog-post-card.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ <h3><a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h3>
2626
</div>
2727

2828
{% if post.banner_image %}
29+
{% assign thumbnail_src = post.banner_image %}
30+
31+
{% if post.banner_image contains 'gsoc-banner.png' %}
32+
{% assign thumbnail_src = "/images/gsoc-logo.svg" %}
33+
{% endif %}
34+
2935
<div class="thumbnail-container">
3036
<a href="{{ post.url | prepend: site.baseurl }}">
31-
<img src="{{ post.banner_image }}" alt="Thumbnail" class="thumbnail-image" />
37+
<img src="{{ thumbnail_src }}" alt="Thumbnail" class="thumbnail-image" />
3238
</a>
3339
</div>
3440
{% endif %}

_layouts/post.html

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,36 @@ <h1 class="post-title" itemprop="name headline">{{ page.title }}</h1>
3131
</header>
3232

3333
{% if page.banner_image %}
34+
{% comment %} Special-case GSoC banner when the image path contains 'gsoc-banner.png' {% endcomment %}
35+
{% if page.banner_image contains 'gsoc-banner.png' %}
36+
<!-- Special GSoC banner composition -->
37+
<div class="gsoc-banner-wrapper" role="img" aria-label="Google Summer of Code — Compiler Research">
38+
<div class="gsoc-banner">
39+
<div class="logo logo-left">
40+
<!-- left GSoC logo: update path if needed -->
41+
<img src="/images/gsoc-logo.svg" alt="Google Summer of Code logo" />
42+
</div>
43+
44+
<div class="at-sign" aria-hidden="true">@</div>
45+
46+
<div class="logo logo-right">
47+
<!-- right Compiler Research logo: update path if needed -->
48+
<img src="/images/cr-logo_old.png" alt="Compiler Research logo" />
49+
</div>
50+
</div>
51+
52+
<div class="gsoc-caption" role="heading" aria-level="2">
53+
Google <strong>Summer of Code</strong>
54+
</div>
55+
</div>
56+
{% else %}
57+
<!-- Default banner -->
3458
<div class="post-banner">
3559
<img src="{{ page.banner_image }}"
3660
alt="Banner Image" class="banner-image" />
3761
</div>
3862
{% endif %}
63+
{% endif %}
3964

4065
<div class="post-content" itemprop="articleBody">{{ content }}</div>
4166

@@ -60,13 +85,110 @@ <h4>Tags:</h4>
6085
object-fit: cover;
6186
}
6287

88+
/* Default post banner (fallback) */
6389
.post-banner .banner-image {
6490
width: 100%;
6591
height: auto;
6692
}
6793

94+
/* Tag badge */
6895
.tag-badge {
6996
background-color: #999999;
7097
padding: 0.5rem;
7198
}
99+
100+
/* ---------------------------
101+
GSoC banner: scalable sizing
102+
---------------------------
103+
Tweak these variables to change sizes.
104+
- --gsoc-wrapper-max: max-width of the banner wrapper (percent of container or px)
105+
- --gsoc-banner-height: height of the banner area (viewport-relative works well)
106+
- --gsoc-logo-scale: fraction of banner height used for logos (0..1)
107+
- --gsoc-at-scale: fraction of banner height used for the @ sign
108+
- --gsoc-caption-scale: fraction of banner height used for caption text
109+
*/
110+
:root {
111+
--gsoc-wrapper-max: 95%; /* percent of container width (or use 1200px) */
112+
--gsoc-banner-height: 25vh; /* change to 16vh or 12vh as needed */
113+
--gsoc-logo-scale: 0.85; /* logos = 85% of banner height */
114+
--gsoc-at-scale: 0.5; /* @ size = 80% of banner height */
115+
--gsoc-caption-scale: 0.25; /* caption size = 35% of banner height */
116+
}
117+
118+
/* wrapper & layout */
119+
.gsoc-banner-wrapper {
120+
width: 100%;
121+
max-width: var(--gsoc-wrapper-max);
122+
margin: 0 auto;
123+
padding: 18px 12px;
124+
box-sizing: border-box;
125+
}
126+
127+
.gsoc-banner {
128+
display: flex;
129+
align-items: center;
130+
justify-content: center;
131+
gap: 4.5rem; /* more spacing when elements are larger */
132+
padding: 8px 0;
133+
}
134+
135+
/* logos */
136+
.logo {
137+
display: flex;
138+
align-items: center;
139+
justify-content: center;
140+
flex: 0 0 auto;
141+
}
142+
143+
/* Logos scale with the banner height (uses CSS calc() and the scale factors) */
144+
.logo img {
145+
display: block;
146+
height: calc(var(--gsoc-banner-height) * var(--gsoc-logo-scale));
147+
width: auto;
148+
max-width: 28vw; /* prevent logos from growing extremely wide on huge screens */
149+
min-height: 48px; /* ensure small-screen readability */
150+
}
151+
152+
/* right logo circular badge appearance (optional) */
153+
.logo-right img {
154+
padding: 8px;
155+
background: #fff;
156+
box-sizing: content-box;
157+
}
158+
159+
/* @ sign scales with banner height */
160+
.at-sign {
161+
font-size: calc(var(--gsoc-banner-height) * var(--gsoc-at-scale));
162+
font-weight: 700;
163+
line-height: 1;
164+
color: #000;
165+
letter-spacing: -0.02em;
166+
display: flex;
167+
align-items: center;
168+
justify-content: center;
169+
}
170+
171+
/* caption scales too */
172+
.gsoc-caption {
173+
text-align: center;
174+
margin-top: 12px;
175+
font-family: Georgia, "Times New Roman", serif;
176+
font-size: calc(var(--gsoc-banner-height) * var(--gsoc-caption-scale));
177+
color: #111;
178+
}
179+
180+
/* Responsive fallbacks: on very small screens, reduce banner height */
181+
@media (max-width: 900px) {
182+
:root { --gsoc-banner-height: 16vh; } /* slightly taller on medium screens */
183+
.gsoc-banner { gap: 2.5rem; }
184+
}
185+
186+
@media (max-width: 520px) {
187+
:root { --gsoc-banner-height: 18vh; } /* stack-friendly sizing */
188+
.gsoc-banner {
189+
flex-direction: column;
190+
gap: 12px;
191+
}
192+
.gsoc-caption { margin-top: 6px; }
193+
}
72194
</style>

images/blog/gsoc-banner.png

-93.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)