diff --git a/website/src/templates/models.js b/website/src/templates/models.js index 29278e919..1c90c60b6 100644 --- a/website/src/templates/models.js +++ b/website/src/templates/models.js @@ -108,6 +108,17 @@ function formatModelMeta(data) { } } +function formatSources(data = []) { + const sources = Array.isArray(data) ? data.map(s => ({ name: s })) : data + return sources.map(({ name, url, author }, i) => ( + <> + {i > 0 && ', '} + {name && url ? {name} : name} + {author && ` (${author})`} + + )) +} + const Help = ({ children }) => ( @@ -142,7 +153,7 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl const releaseUrl = `https://github.com/${repo}/releases/${releaseTag}` const pipeline = meta.pipeline && join(meta.pipeline.map(p => {p})) - const sources = meta.sources && join(meta.sources) + const sources = formatSources(meta.sources) const author = !meta.url ? meta.author : {meta.author} const licenseUrl = licenses[meta.license] ? licenses[meta.license].url : null const license = licenseUrl ? {meta.license} : meta.license