Skip to content

Commit 430c7d6

Browse files
committed
fix(#160): Differentiate prefix and separator…
This is more logical as the data is in the same Website object.
1 parent 3a8cd2e commit 430c7d6

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

_src/_data/participants/tom-hazledine.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ display = "Tom Hazledine"
66
[[websites]]
77
url = "https://tomhazledine.com/"
88
years = [2020,2024,2025]
9-
suffix = ''
109

1110
[[websites]]
12-
url = "https://tomhazledine.com/css-naked-day/"
13-
title = "always naked"
14-
years = [2024,2025]
15-
prefix = " (some of which is "
16-
suffix = ")"
11+
url = "https://tomhazledine.com/css-naked-day/"
12+
title = "always naked"
13+
years = [2024,2025]
14+
prefix = " (some of which is "
15+
suffix = ")"
16+
separator = ''

_src/year.njk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
{%- else -%}
5959
{{ participant | getParticipantDisplayName }}:
6060

61-
{% for website in websites %}
62-
{% linkNoSpam 'getSiteTitle', website, participant, year, loop.revindex0 %}
63-
{% endfor %}
61+
{% for website in websites -%}
62+
{% linkNoSpam 'getSiteTitle', website, participant, year, loop.index0 %}
63+
{%- endfor %}
6464
{% endif %}
6565
</li>
6666
{% endfor %}

eleventy.config.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export default function (eleventyConfig) {
5050
};
5151

5252
let title;
53+
let separator = website.separator;
5354
let prefix = website.prefix;
5455
let suffix = website.suffix;
5556

@@ -62,19 +63,19 @@ export default function (eleventyConfig) {
6263
break;
6364
}
6465

65-
if (suffix === undefined && loopRevIndex0) {
66-
suffix = loopRevIndex0 > 1 ? ', ' : ' & ';
66+
if (separator === undefined && loopRevIndex0) {
67+
separator = loopRevIndex0 > 1 ? ' & ' : ', ';
6768
}
6869

69-
if (!website?.url) {
70+
if (!website.url) {
7071
return title;
7172
}
7273

7374
if (website.spam) {
7475
return website.url;
7576
}
7677

77-
return `${prefix || ''}<a href="${website.url}">${title}</a>${suffix || ''}`
78+
return `${separator ?? ''}${prefix ?? ''}<a href="${website.url}">${title}</a>${suffix ?? ''}`
7879
});
7980

8081
// TODO: Add a tool to target duplicated domains.

0 commit comments

Comments
 (0)