Skip to content

Commit 7108b77

Browse files
feat: add contributors to home page (#23)
1 parent 38da109 commit 7108b77

4 files changed

Lines changed: 58 additions & 1 deletion

File tree

src/_data/contributors.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"contributors": []
3+
}

src/_includes/layouts/home.njk

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
</div>
3535
</div>
3636
</div>
37+
{% if contributors.contributors | length %}
3738
<div class="[ bg bg--green-85 ]">
3839
<div class="[ wrapper ]">
3940
<div class="[ flow center prose ]">
@@ -44,10 +45,21 @@
4445
</div>
4546
<div>
4647
<div class="[ wrapper ]">
47-
<div class="[ flow prose ]">
48+
<div class="[ contributors ]">
49+
{% for contributor in contributors.contributors %}
50+
<a href="{{ contributor.link }}" rel="external">
51+
{% if contributor.image %}
52+
<img src="{{ contributor.image }}" width="150" height="150" alt="" />
53+
{% else %}
54+
<img src="https://source.boringavatars.com/ring/150/{{ contributor.name | replace(' ', '%20') }}?colors=516d95,d2a27a,882211,337777,f75322" width="150" height="150" alt="" />
55+
{% endif %}
56+
<span>{{ contributor.name }}</span>
57+
</a>
58+
{% endfor %}
4859
</div>
4960
</div>
5061
</div>
62+
{% endif %}
5163
<div class="[ bg bg--orange-75 ]">
5264
<div class="[ wrapper ]">
5365
<div class="[ flow center prose ]">

src/admin/config.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,15 @@ collections:
184184
- {label: Author Name, name: authorName, widget: string}
185185
- {label: Author Email, name: authorEmail, widget: string}
186186
- {label: Author Website, name: authorWebsite, widget: string}
187+
- label: Contributors
188+
name: contributors
189+
file: src/_data/contributors.json
190+
fields:
191+
- label: Contributors
192+
name: contributors
193+
widget: list
194+
summary: "{{fields.name}}"
195+
fields:
196+
- {label: Name, name: name, widget: string}
197+
- {label: Link, name: link, widget: string}
198+
- {label: Photo, name: photo, widget: image, required: false}

src/assets/styles/pages/_home.scss

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,33 @@
55
.home article .header .prose {
66
margin-inline: auto;
77
}
8+
9+
.home .contributors {
10+
display: grid;
11+
grid-template-columns: repeat(2, 1fr);
12+
margin-inline: auto;
13+
row-gap: calc(5 * var(--space-md));
14+
15+
a {
16+
display: block;
17+
font-weight: bold;
18+
text-align: center;
19+
20+
img {
21+
border-radius: 50%;
22+
display: block;
23+
margin-inline: auto;
24+
}
25+
26+
span {
27+
display: block;
28+
margin-block-start: var(--space-sm);
29+
}
30+
}
31+
}
32+
33+
@media (min-width: 960px) {
34+
.home .contributors {
35+
grid-template-columns: repeat(5, 1fr);
36+
}
37+
}

0 commit comments

Comments
 (0)