Skip to content

Commit b7dfd08

Browse files
committed
feat: Allow to mark websites as home or not home.
1 parent d337310 commit b7dfd08

File tree

7 files changed

+82
-19
lines changed

7 files changed

+82
-19
lines changed

README.md

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ We are using [Toml configuration files](https://toml.io/) to structure data. Her
1616

1717
### Bare minimum
1818

19-
The following will show as “_[css-naked-day.org]_”:
19+
The following will show as “_[css-naked-day.org][]_”:
2020

2121
```toml
2222
[[websites]]
@@ -26,7 +26,7 @@ years = [2006, 2010]
2626

2727
### With a display name
2828

29-
The following will show as “_[Naked Days Corp]_”:
29+
The following will show as “_[Naked Days Corp][]_”:
3030

3131
```toml
3232
display = "Naked Days Corp"
@@ -36,22 +36,64 @@ url = "https://css-naked-day.org/"
3636
years = [2006, 2010]
3737
```
3838

39+
### With a display name and one website
40+
41+
If you add `homeURL = false` to a website, the URL will not apply to your _display_ name.
42+
43+
The following will show as “_Naked Days Corp: [CSS Naked Day][]_” instead of “_[Naked Days Corp][]_”.
44+
45+
```toml
46+
display = "Naked Days Corp"
47+
48+
[[websites]]
49+
url = "https://css-naked-day.org/"
50+
homeURL = false
51+
years = [2006, 2010]
52+
```
53+
3954
### With multiple websites
4055

41-
The following will show as “_[Naked Days Corp]_” in 2006 and “_Naked Days Corp: [CSS Naked Day] & [JS Naked Day]_” in 2010:
56+
The following will show as:
57+
58+
*_[Naked Days Corp][]_” in 2006,
59+
*_Naked Days Corp: [CSS Naked Day][] & [JS Naked Day][]_” in 2008,
60+
*_[Naked Days Corp][JS Naked Day]_” in 2010:
4261

4362
```toml
4463
display = "Naked Days Corp"
4564

4665
[[websites]]
4766
url = "https://css-naked-day.org/"
4867
title = "CSS Naked Day"
49-
years = [2006, 2010]
68+
years = [2006, 2008]
5069

5170
[[websites]]
5271
url = "https://js-naked-day.org/"
5372
title = "JS Naked Day"
54-
years = [2010]
73+
years = [2008, 2010]
74+
```
75+
76+
Adding `homeURL = true` on a website will only merge this one with your _display_ name.
77+
78+
The following will show as:
79+
80+
*_[Naked Days Corp][]_” in 2006,
81+
*_Naked Days Corp: [CSS Naked Day][] & [JS Naked Day][]_” in 2008,
82+
*_Naked Days Corp: [JS Naked Day][]_” in 2010:
83+
84+
```toml
85+
display = "Naked Days Corp"
86+
87+
[[websites]]
88+
url = "https://css-naked-day.org/"
89+
homeURL = true
90+
title = "CSS Naked Day"
91+
years = [2006, 2008]
92+
93+
[[websites]]
94+
url = "https://js-naked-day.org/"
95+
title = "JS Naked Day"
96+
years = [2008, 2010]
5597
```
5698

5799
### Advanced formatting
@@ -62,6 +104,8 @@ His websites will appear as “_Tom Hazledine: [tomhazledine.com](https://tomhaz
62104

63105
### More than complete
64106

107+
---
108+
65109
We are not using all data yet, but feel free to add them, as we might improve the website with it!
66110

67111
External accounts can also be a good way to join you.
@@ -118,5 +162,4 @@ npm run dev
118162
[css-naked-day.org]: https://css-naked-day.org/
119163
[Naked Days Corp]: https://css-naked-day.org/
120164
[CSS Naked Day]: https://css-naked-day.org/
121-
[Naked]: https://css-naked-day.org/
122165
[JS Naked Day]: https://js-naked-day.org/

_src/_data/participants/dominik-schwind.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ display = "Dominik Schwind"
44
# ------------------------------------------------------------------------------
55

66
[[websites]]
7-
url = "https://lostfocus.de/"
8-
title = "LostFocus"
9-
years = [ 2024 ]
7+
url = "https://lostfocus.de/"
8+
homeURL = false
9+
title = "LostFocus"
10+
years = [ 2024 ]

_src/_data/participants/jens-meiert.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ username = "j9t"
99

1010
[[websites]]
1111
url = "https://meiert.com/"
12+
homeURL = true
1213
years = [
1314
2006,
1415
2015,

_src/_data/participants/matthew-graybosch.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ display = "Matthew Graybosch"
44
# ------------------------------------------------------------------------------
55

66
[[websites]]
7-
url = "https://starbreaker.org/"
8-
title = "starbreaker.org"
9-
years = [ 2025 ]
7+
url = "https://starbreaker.org/"
8+
homeURL = false
9+
title = "starbreaker.org"
10+
years = [ 2024, 2025 ]
1011

_src/_data/participants/sime-vidas.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ display = "Šime Vidas"
44
# ------------------------------------------------------------------------------
55

66
[[websites]]
7-
url = "https://webplatform.news/"
8-
title = "Web Platform News"
9-
years = [ 2023 ]
7+
url = "https://webplatform.news/"
8+
homeURL = false
9+
title = "Web Platform News"
10+
years = [ 2023 ]

_src/year.njk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@
4848
<ol>
4949
{% for filename, participations in participations | getParticipantsForYear(year) | groupby('participant') %}
5050
{% set participant = participants[filename] %}
51-
{% set websites = participant | getParticipantWebsitesForYear(year) %}
51+
{% set websitesForYear = participant | getParticipantWebsitesForYear(year) %}
5252

5353
<li>
54-
{%- if websites | length === 1 -%}
55-
{% linkNoSpam filename | getParticipantDisplayName, websites[0] %}
54+
{%- if participant | mergeNameWithURL(websitesForYear) -%}
55+
{% linkNoSpam filename | getParticipantDisplayName, websitesForYear[0] %}
5656
{%- else -%}
5757
{{- filename | getParticipantDisplayName }}:
58-
{% formatWebsitesForYear websites -%}
58+
{% formatWebsitesForYear websitesForYear -%}
5959
{% endif -%}
6060
</li>
6161
{% endfor %}

eleventy.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ export default function (eleventyConfig) {
4141
return participant.websites.filter(website => website.years.includes(year));
4242
});
4343

44+
eleventyConfig.addFilter('mergeNameWithURL', function(participant, websitesForYear) {
45+
// Is there only one website for the current year?
46+
if (websitesForYear.length > 1) {
47+
return false;
48+
}
49+
50+
// Is there at least one `homeURL` in the user file.
51+
const hasHomeURL = participant.websites.some(website => website.homeURL !== undefined);
52+
53+
if (!hasHomeURL) {
54+
return true;
55+
}
56+
57+
return websitesForYear[0].homeURL;
58+
});
59+
4460
// eleventyComputed data filters.
4561
// ---------------------------------------------------------------------------
4662

0 commit comments

Comments
 (0)