<% function kebabToTitleCase(str) { return str .split('-') // Split the string into words using the hyphen as the delimiter .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) // Capitalize the first letter of each word .join(' '); // Join the words back together with spaces } %>
<% if (ctx.response.results.length) { %> <% for (const pool of ctx.response.results) { %> '>
<% let counter = 0 %> <% for (const post of pool.posts) { %>
<% counter++ %> <% if (counter === 4) break %> <% } %>
<%= kebabToTitleCase(pool.names[0]) %> (<%- pool.postCount %>)
<% } %> <% } else { %>

No pools to display.

<% } %>
<% if (ctx.response.results.length) { %> <% for (let pool of ctx.response.results) { %> <% } %>
<% if (ctx.parameters.query == 'sort:name' || !ctx.parameters.query) { %> '>Pool name(s) <% } else { %> '>Pool name(s) <% } %> <% if (ctx.parameters.query == 'sort:post-count') { %> '>Post count <% } else { %> '>Post count <% } %> <% if (ctx.parameters.query == 'sort:creation-time') { %> '>Created on <% } else { %> '>Created on <% } %>
    <% for (let name of pool.names) { %>
  • <%= ctx.makePoolLink(pool.id, false, false, pool, name) %>
  • <% } %>
'><%- pool.postCount %> <%= ctx.makeRelativeTime(pool.creationTime) %>
<% } %>