mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig.space.git
synced 2025-12-13 16:26:50 +00:00
Introduce aliases for team members
This commit is contained in:
17
helpers.js
17
helpers.js
@@ -37,10 +37,25 @@ const truncate = (str, wordCount) => {
|
||||
return [head, tail]
|
||||
}
|
||||
|
||||
// team
|
||||
const teamWithAliases = team => {
|
||||
const withAliases = {}
|
||||
Object.entries(team).forEach(([id, member]) => {
|
||||
withAliases[id] = member
|
||||
const aliases = (member.aliases || []).concat(member.name.toLowerCase())
|
||||
aliases.forEach(alias => {
|
||||
const aliasId = alias.toLowerCase()
|
||||
if (!withAliases[aliasId]) withAliases[aliasId] = member
|
||||
})
|
||||
})
|
||||
return withAliases
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
markdown: mdTransformer.render,
|
||||
replacements,
|
||||
slugify,
|
||||
stripHTML,
|
||||
truncate
|
||||
truncate,
|
||||
teamWithAliases
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user