Skip to content

Commit b1ecafe

Browse files
committed
Better profile pages
1 parent 725cd1d commit b1ecafe

File tree

4 files changed

+112
-20
lines changed

4 files changed

+112
-20
lines changed

_assets/kevin_headshot.png

123 KB
Loading

_css/cards.css

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,77 @@
6969
.card-button:hover{
7070
background-color:#555;
7171
}
72+
/* Horizontal profile card */
73+
.profile-header {
74+
display: flex;
75+
flex-direction: row;
76+
justify-content: space-between;
77+
align-items: flex-start;
78+
margin-bottom: 2rem;
79+
padding: 1.5rem;
80+
background-color: #f9f9f9;
81+
border-radius: 8px;
82+
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
83+
}
84+
85+
.profile-info {
86+
flex: 1;
87+
padding-right: 2rem;
88+
}
89+
90+
.profile-name {
91+
margin-top: 0;
92+
margin-bottom: 0.5rem;
93+
font-size: 2rem;
94+
}
95+
96+
.profile-title {
97+
color: #555;
98+
font-size: 1.2rem;
99+
margin-bottom: 1rem;
100+
}
101+
102+
.profile-email {
103+
font-family: courier;
104+
margin-bottom: 1rem;
105+
word-break: break-all;
106+
overflow-wrap: break-word;
107+
}
108+
109+
.profile-button {
110+
border: none;
111+
outline: 0;
112+
padding: 10px 20px;
113+
color: white;
114+
background-color: #000;
115+
text-align: center;
116+
cursor: pointer;
117+
border-radius: 4px;
118+
font-size: 1rem;
119+
}
72120

121+
.profile-button:hover {
122+
background-color: #333;
123+
}
124+
125+
.profile-image-container {
126+
width: 30%;
127+
max-width: 250px;
128+
}
129+
130+
.profile-image {
131+
width: 100%;
132+
border-radius: 8px;
133+
box-shadow: 0 2px 6px rgba(0,0,0,0.2);
134+
}
135+
136+
.profile-vitae {
137+
font-style: italic;
138+
margin-bottom: 2rem;
139+
padding: 0 1rem;
140+
border-left: 3px solid #ddd;
141+
}
142+
143+
.profile-content {
144+
line-height: 1.6;
145+
}

people/kevin.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ using Dates
33
name="Kevin Bonham"
44
title="Assistant Professor"
55
vitae="Benevolant dictator"
6+
portrait="/assets/kevin_headshot.png"
67
email="kevin.bonham@tuftsmedicine.org"
78
joined = Date(2025,02,01)
89
+++

utils.jl

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ function hfun_list_people()
1919
(
2020
node("div", class="card-column",
2121
node("div", class="card-body",
22-
node("img", src="/assets/portrait_placeholder.png"),
22+
node("img", src=p.portrait),
2323
node("div", class="card-container",
24-
node("h2", node("a", href=p.href, p.name)),
24+
node("h2", node("a", href=p.href, p.name)),
2525
node("div", class="card-title", p.title),
2626
node("div", class="card-vitae", p.vitae),
27-
node("div", class="card-email", p.email),
28-
node("p", node("a", href="mailto:$(p.email)",
29-
node("button", class="card-button", "Contact")
27+
node("div", class="card-email", node("a", href="mailto:$(p.email)", p.email)),
28+
node("p", node("a", href=p.href,
29+
node("button", class="card-button", "Details")
3030
)
3131
)
3232
)
@@ -37,6 +37,20 @@ function hfun_list_people()
3737
)
3838
end
3939

40+
function person_info(rp)
41+
return (;
42+
date=getvarfrom(:joined, rp),
43+
name=getvarfrom(:name, rp),
44+
title=getvarfrom(:title, rp),
45+
email=getvarfrom(:email, rp),
46+
portrait=getvarfrom(:portrait, rp, "/assets/portrait_placeholder.png"),
47+
vitae=getvarfrom(:vitae, rp),
48+
alumn=getvarfrom(:alumn, rp, false),
49+
href="/$(splitext(rp)[1])",
50+
tags=get_page_tags(rp)
51+
)
52+
end
53+
4054
function get_people(basepath::String="people")
4155
# find all valid "people/xxx.md" files, exclude the index which is where
4256
# the people list gets placed
@@ -46,27 +60,31 @@ function get_people(basepath::String="people")
4660
append!(paths, joinpath.(root, files))
4761
end
4862
# for each of those people, get their info
49-
posts = [
50-
(
51-
date=getvarfrom(:joined, rp),
52-
name=getvarfrom(:name, rp),
53-
title=getvarfrom(:title, rp),
54-
email=getvarfrom(:email, rp),
55-
vitae=getvarfrom(:vitae, rp),
56-
alumn=getvarfrom(:alumn, rp, false),
57-
href="/$(splitext(rp)[1])",
58-
tags=get_page_tags(rp)
59-
)
60-
for rp in paths
61-
]
63+
posts = [person_info(rp) for rp in paths]
6264
sort!(posts, by=x -> x.date)
6365

6466
return posts
6567
end
6668

6769
function hfun_person_header()
68-
name = getlvar(:name, getlvar(:title))
69-
return string(node("div", class="franklin-content", node("h1", name)))
70+
person = person_info(get_rpath())
71+
return string(node("div", class="franklin-content",
72+
73+
node("div", class="profile-header",
74+
node("div", class="profile-info",
75+
node("h1", class="profile-name", person.name),
76+
node("div", class="profile-title", person.title),
77+
node("div", class="profile-vitae", person.vitae),
78+
node("div", class="profile-email",
79+
node("a", href="mailto:$(person.email)", person.email)
80+
),
81+
),
82+
node("div", class="profile-image-container",
83+
node("img", class="profile-image", src=person.portrait, alt="$(person.name)")
84+
)
85+
),
86+
87+
))
7088
end
7189

7290
function hfun_list_projects()

0 commit comments

Comments
 (0)