#34 - aliases have the same weight as the basename

This commit is contained in:
Simon Cambier
2022-05-11 09:28:25 +02:00
parent a395a77e5b
commit 0cdb3c84a9
6 changed files with 72 additions and 9 deletions

View File

@@ -147,3 +147,10 @@ export async function filterAsync<T>(
export function stripMarkdownCharacters(text: string): string {
return text.replace(/(\*|_)+(.+?)(\*|_)+/g, (match, p1, p2) => p2)
}
export function getAliasesFromMetadata(
metadata: CachedMetadata | null,
): string {
const arrOrString = metadata?.frontmatter?.aliases ?? []
return Array.isArray(arrOrString) ? arrOrString.join(', ') : arrOrString
}