forked from rstudio/helm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexamples.ejs
36 lines (34 loc) · 825 Bytes
/
examples.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<%
const postsByCategory = {};
const basicConfigPosts = [];
items.forEach(item => {
if (item.category === "Basic configuration") {
basicConfigPosts.push(item)
} else {
if (!postsByCategory[item.category]) {
postsByCategory[item.category] = [];
}
postsByCategory[item.category].push(item);
}
});
// Basic config first
if (basicConfigPosts.length > 0) { %>
<h2>Basic configuration</h2>
<ul>
<% basicConfigPosts.forEach(post => { %>
<li>
<a href="<%= post.path %>"><%=post.title %></a>
</li>
<% }) %>
</ul>
<% } %>
<% for (const [category, categoryPosts] of Object.entries(postsByCategory)) { %>
<h2><%= category %></h2>
<ul>
<% categoryPosts.forEach(post => { %>
<li>
<a href="<%= post.path %>"><%= post.title %></a>
</li>
<% }) %>
</ul>
<% } %>