Skip to content

Commit bec38c8

Browse files
committed
feat: improve avatar quality and add customizable sizing options
Resolves #3123 ## What Changed **Avatar Quality Improvements:** - Generate avatars at 2x resolution for crisp display on high-DPI screens - Updated Hugo imaging config with quality: 90, lanczos resampling, and picture hint - Improved WebP compression quality across all avatar locations **New Customization Parameters:** - Added design.avatar.size with 5 options: small (150px), medium (200px), large (320px), xl (400px), xxl (500px) - Added design.avatar.shape with 3 options: circle (default), square, rounded - Sizing aligned with 2025 social media standards (LinkedIn/X: 400px, Instagram: 320px, TikTok: 200px) **Updated Templates:** - Enhanced resume-biography.html and resume-biography-3.html with flexible parameter system - Updated all starter templates (academic-cv, resume, blog, link-in-bio) with example configurations - Improved avatar CSS for dynamic sizing control
1 parent b90b1f2 commit bec38c8

File tree

19 files changed

+106
-34
lines changed

19 files changed

+106
-34
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
blank_issues_enabled: false
22
contact_links:
3-
- name: Questions
3+
- name: 💬 Contributing chat (Discord)
44
url: https://discord.gg/z8wNYzb
5-
about: Chat live with the Hugo Blox Builder community on Discord.
6-
- name: Discussions
7-
url: https://github.com/HugoBlox/hugo-blox-builder/discussions
8-
about: Discuss Hugo Blox Builder on the GitHub Discussions forum
9-
- name: Troubleshooting Guide
5+
about: Ask quick questions in the Contributing channel and coordinate with Geo & contributors.
6+
7+
- name: 🧪 Troubleshooting Guide
108
url: https://docs.hugoblox.com/reference/troubleshooting/
11-
about: Solve common issues fast.
12-
- name: Documentation
9+
about: Fix common issues fast and follow the reproducible-issue checklist before filing.
10+
11+
- name: 🏷️ Help-wanted issues (good first tasks)
12+
url: https://github.com/HugoBlox/hugo-blox-builder/labels/help%20wanted
13+
about: Pick a bite-sized task and open your first PR in minutes.
14+
15+
- name: 🧭 Contributing Guide
16+
url: https://github.com/HugoBlox/hugo-blox-builder/blob/main/CONTRIBUTING.md
17+
about: How we work, environment setup, style, and PR tips.
18+
19+
- name: 🧵 Discussions (Q&A, ideas)
20+
url: https://github.com/HugoBlox/hugo-blox-builder/discussions
21+
about: Ask for help, propose features, or share learnings.
22+
23+
- name: 📚 Documentation
1324
url: https://docs.hugoblox.com/
14-
about: Review the documentation
25+
about: Explore all Hugo Blox docs, tutorials, and references.
26+
27+
- name: 💚 Support Hugo Blox (All Access)
28+
url: https://hugoblox.com/all-access
29+
about: Too busy to contribute? Support development and get lifetime template updates.
30+
31+
- name: 🫶 Sponsor on GitHub
32+
url: https://github.com/sponsors/gcushen
33+
about: Prefer monthly or one-time sponsorship via GitHub.

modules/blox-tailwind/assets/css/blox/biography.css

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
position: relative;
66
}
77

8-
/* Custom avatar size on homepage */
8+
/* Custom avatar size on homepage - size controlled by template params */
99

1010
.avatar {
1111
width: auto;
1212
height: auto;
13-
max-width: 225px;
14-
max-height: 225px;
1513
object-fit: cover;
1614
}
1715

@@ -97,8 +95,7 @@
9795

9896
.avatar-wrapper {
9997
position: relative;
100-
width: 150px; /* Match image size in about.avatar widget */
101-
height: 150px;
98+
/* width and height controlled by template params */
10299
margin-left: auto;
103100
margin-right: auto;
104101
}

modules/blox-tailwind/hugo.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ outputFormats:
102102
baseName: backlinks
103103
isPlainText: true
104104
notAlternative: true
105+
imaging:
106+
# High quality defaults for crisp avatar display
107+
quality: 90
108+
resampleFilter: lanczos
109+
anchor: smart
110+
hint: picture
105111
params:
106112
locale:
107113
date_format: 'Jan 2, 2006'

modules/blox-tailwind/layouts/_partials/blox/resume-biography-3.html

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,20 @@
1515
{{end}}
1616
{{ $person := $person_page.Params }}
1717
{{ $avatar := ($person_page.Resources.ByType "image").GetMatch "*avatar*" }}
18-
{{ $avatar_shape := site.Params.features.avatar.shape | default "circle" }}
18+
19+
{{/* Avatar customization parameters */}}
20+
{{ $avatar_size := $block.design.avatar.size | default "medium" }}
21+
{{ $avatar_shape := $block.design.avatar.shape | default "circle" }}
22+
23+
{{/* Size mappings optimized for 2025 standards: display_size -> [display_px, generation_px] */}}
24+
{{ $size_map := dict "small" (slice "150" "300") "medium" (slice "200" "400") "large" (slice "320" "640") "xl" (slice "400" "800") "xxl" (slice "500" "1000") }}
25+
{{ $size_config := index $size_map $avatar_size | default (index $size_map "medium") }}
26+
{{ $display_size := index $size_config 0 }}
27+
{{ $generation_size := index $size_config 1 }}
28+
29+
{{/* Shape class mappings */}}
30+
{{ $shape_classes := dict "circle" "rounded-full" "square" "rounded-none" "rounded" "rounded-lg" }}
31+
{{ $shape_class := index $shape_classes $avatar_shape | default "rounded-full" }}
1932

2033

2134
<div class="resume-biography px-3 flex flex-col md:flex-row justify-center gap-12">
@@ -42,10 +55,11 @@
4255
<div id="profile" class="flex justify-center items-center flex-col">
4356
{{ if $avatar }}
4457

45-
<div class="avatar-wrapper {{ if $img }}-mt-[105px]{{else}}mt-10{{end}}">
46-
{{ $avatar_image := $avatar.Fill "150x150 Center" }}
47-
<img class="avatar rounded-full bg-white dark:bg-gray-800 p-1" src="{{ $avatar_image.RelPermalink }}" alt="{{$person_page.Title}}"
48-
width="{{ $avatar_image.Width }}" height="{{ $avatar_image.Height }}">
58+
<div class="avatar-wrapper {{ if $img }}-mt-[105px]{{else}}mt-10{{end}}" style="width: {{$display_size}}px; height: {{$display_size}}px;">
59+
{{ $avatar_image := $avatar.Fill (printf "%sx%s Center" $generation_size $generation_size) }}
60+
<img class="avatar {{$shape_class}} bg-white dark:bg-gray-800 p-1" src="{{ $avatar_image.RelPermalink }}" alt="{{$person_page.Title}}"
61+
width="{{$display_size}}" height="{{$display_size}}"
62+
style="width: {{$display_size}}px; height: {{$display_size}}px; object-fit: cover;">
4963
{{with $person.status.icon}}<span class="avatar-emoji">{{.|emojify}}</span>{{end}}
5064
</div>
5165
{{ end }}

modules/blox-tailwind/layouts/_partials/blox/resume-biography.html

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,20 @@
1515
{{end}}
1616
{{ $person := $person_page.Params }}
1717
{{ $avatar := ($person_page.Resources.ByType "image").GetMatch "*avatar*" }}
18-
{{ $avatar_shape := site.Params.features.avatar.shape | default "circle" }}
18+
19+
{{/* Avatar customization parameters */}}
20+
{{ $avatar_size := $block.design.avatar.size | default "medium" }}
21+
{{ $avatar_shape := $block.design.avatar.shape | default "circle" }}
22+
23+
{{/* Size mappings optimized for 2025 standards: display_size -> [display_px, generation_px] */}}
24+
{{ $size_map := dict "small" (slice "150" "300") "medium" (slice "200" "400") "large" (slice "320" "640") "xl" (slice "400" "800") "xxl" (slice "500" "1000") }}
25+
{{ $size_config := index $size_map $avatar_size | default (index $size_map "medium") }}
26+
{{ $display_size := index $size_config 0 }}
27+
{{ $generation_size := index $size_config 1 }}
28+
29+
{{/* Shape class mappings */}}
30+
{{ $shape_classes := dict "circle" "rounded-full" "square" "rounded-none" "rounded" "rounded-lg" }}
31+
{{ $shape_class := index $shape_classes $avatar_shape | default "rounded-full" }}
1932

2033
{{ $img := "" }}
2134
{{with $block.design.banner.filename}}
@@ -38,10 +51,11 @@
3851
<div id="profile" class="resume-biography flex justify-center items-center flex-col dark:text-white">
3952
{{ if $avatar }}
4053

41-
<div class="avatar-wrapper {{ if $img }}-mt-[105px]{{else}}mt-10{{end}}">
42-
{{ $avatar_image := $avatar.Fill "150x150 Center" }}
43-
<img class="avatar rounded-full bg-white dark:bg-gray-800 p-1" src="{{ $avatar_image.RelPermalink }}" alt="{{$person_page.Title}}"
44-
width="{{ $avatar_image.Width }}" height="{{ $avatar_image.Height }}">
54+
<div class="avatar-wrapper {{ if $img }}-mt-[105px]{{else}}mt-10{{end}}" style="width: {{$display_size}}px; height: {{$display_size}}px;">
55+
{{ $avatar_image := $avatar.Fill (printf "%sx%s Center" $generation_size $generation_size) }}
56+
<img class="avatar {{$shape_class}} bg-white dark:bg-gray-800 p-1" src="{{ $avatar_image.RelPermalink }}" alt="{{$person_page.Title}}"
57+
width="{{$display_size}}" height="{{$display_size}}"
58+
style="width: {{$display_size}}px; height: {{$display_size}}px; object-fit: cover;">
4559
{{with $person.status.icon}}<span class="avatar-emoji">{{.|emojify}}</span>{{end}}
4660
</div>
4761
{{ end }}

modules/blox-tailwind/layouts/_partials/page_author_card.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<div class="flex pt-12 pb-4">
1717
{{ if $avatar }}
18-
{{ $authorImage := $avatar.Fill "192x192 Center" }}
18+
{{ $authorImage := $avatar.Fill "384x384 Center" }}
1919
<img
2020
class="mr-4 h-24 w-24 {{if ne $avatar_shape "square"}}rounded-full{{end}}"
2121
width="96"

modules/blox-tailwind/layouts/_partials/site_head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
{{ $twitter_card := "summary_large_image" }}
150150
{{ if (and (eq .Kind "term") $avatar_image) }}
151151
{{/* Match image processing in About widget to prevent generating more images than necessary. */}}
152-
{{ $og_image = ($avatar_image.Fill "270x270 Center").Permalink }}
152+
{{ $og_image = ($avatar_image.Fill "540x540 Center").Permalink }}
153153
{{ $twitter_card = "summary" }}
154154
{{ else if $featured_image }}
155155
{{ $og_image = $featured_image.Permalink }}

modules/blox-tailwind/layouts/_partials/views/article-grid.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h2 class="text-lg font-semibold leading-snug tracking-tight mt-2 dark:text-whit
7070
<div class="relative h-5 w-5 flex-shrink-0">
7171
{{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }}
7272
{{ if $avatar }}
73-
{{ $authorImage := $avatar.Process "Fill 50x50 Center 95 webp" }}
73+
{{ $authorImage := $avatar.Process "Fill 100x100 Center webp" }}
7474
<img alt="avatar"
7575
class="rounded-full object-cover"
7676
data-nimg="fill"

modules/blox-tailwind/layouts/single.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h1 class="mt-2 text-4xl font-bold tracking-tight text-slate-900 dark:text-slate
4848
{{ end }}
4949
<div class="group inline-flex items-center text-current gap-x-1.5 mx-1">
5050
{{ with $avatar }}
51-
{{ $avatar = $avatar.Process "Fill 50x50 Center webp" }}
51+
{{ $avatar = $avatar.Process "Fill 100x100 Center webp" }}
5252
<img src="{{ $avatar.RelPermalink }}" alt="{{ $author_page.Title }}" class="inline-block h-4 w-4 rounded-full border border-current" loading="lazy" />
5353
{{ end }}
5454
<div {{if $author_page.Params.website}}class="group-hover:underline"{{end}}>{{ $author_page.Title }}</div>

starters/academic-cv/config/_default/hugo.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ outputs:
3939
section: [HTML, RSS]
4040
imaging:
4141
resampleFilter: lanczos
42-
quality: 80
42+
quality: 90
4343
anchor: smart
44+
hint: picture
4445
timeout: 600000
4546
taxonomies:
4647
author: authors

0 commit comments

Comments
 (0)