Skip to content

Commit 8da67a0

Browse files
committed
Add templating for links, start with ORCID as demo
1 parent 76f6bdd commit 8da67a0

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

people.ejs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
<h2><%- item.group %></h2>
44
<ul>
55
<% for (const member of item.members) { %>
6-
<li>
7-
<% if (member.website) { %><a href="<%- member.website %>"><% }
8-
%><%- member.name %><% if (member.website) { %></a><% } %>
9-
</li>
6+
<li><%
7+
if (member.website) { %><a href="<%- member.website %>"><% }
8+
%><%- member.name %><%
9+
if (member.website) { %></a><% }
10+
for (const [link, field] of Object.entries(templateParams)) {
11+
if (member[link]) {
12+
%> <a href="<%- field.base_url %><%- member[link] %>"><img src="<%- field.icon %>" alt="<%- field.alt %>"></a><%
13+
}
14+
}
15+
%></li>
1016
<% } %>
1117
</ul>
1218
<% } %>

people.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ listing:
44
template: people.ejs
55
contents:
66
- people.yml
7+
template-params:
8+
# For each icon, add the base URL, icon URL and alt text
9+
# The base URL will be concatenated with the field in the member definition
10+
# For example, ORCID will produce links like
11+
# <a href="{orcid.base_url}{member.orcid}"><img src="{orcid.icon}" alt="{orcid.alt}"></a>
12+
# <a href="https://orcid.org/{member.orcid}"><img src="..." alt="ORCID"></a>
13+
orcid:
14+
base_url: https://orcid.org/
15+
icon: https://info.orcid.org/wp-content/uploads/2019/11/orcid_16x16.png
16+
alt: ORCID
717
format:
818
html:
919
page-layout: full

people.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
members:
44
- name: Russ Poldrack
55
website: https://poldrack.github.io
6+
orcid: 0000-0001-6755-0259
67

78
- group: Research Scientists
89
members:
@@ -38,6 +39,7 @@
3839
- name: Nell Hardcastle
3940
- name: Mathias Goncalves
4041
- name: Chris Markiewicz
42+
orcid: 0000-0002-6533-164X
4143

4244
- group: Lab Alumni
4345
members:

0 commit comments

Comments
 (0)