diff --git a/libs/blocks/recommended-articles/recommended-articles.js b/libs/blocks/recommended-articles/recommended-articles.js index 56a4bbf809..567441cc4e 100644 --- a/libs/blocks/recommended-articles/recommended-articles.js +++ b/libs/blocks/recommended-articles/recommended-articles.js @@ -20,10 +20,12 @@ async function getArticleDetails(article) { const ending = trimEndings.find((el) => title.endsWith(el)); [title] = title.split(ending); + const category = getMetadata('category', doc) || getMetadata('article:tag', doc); + return { title, path, - category: getMetadata('article:tag', doc), + category, description: getMetadata('description', doc), imageEl: doc.querySelector('picture'), date: getMetadata('publication-date', doc), diff --git a/libs/scripts/taxonomy.js b/libs/scripts/taxonomy.js index 9dd68a22bd..91ed89bd6f 100644 --- a/libs/scripts/taxonomy.js +++ b/libs/scripts/taxonomy.js @@ -83,7 +83,7 @@ function parseTaxonomyJson(data, root, route) { : (level2 ? LEVEL_INDEX.level2 : LEVEL_INDEX.level1); - const name = level3 || level2 || level1; + const name = (level3 || level2 || level1)?.toLowerCase(); const category = row[TAXONOMY_FIELDS.type]?.trim().toLowerCase() || INTERNALS; // skip duplicates @@ -181,7 +181,7 @@ export default async (config, route, target) => { get(topic, cat) { // take first one of the list - const item = findItem(topic, cat, taxonomy); + const item = findItem(topic?.toLowerCase(), cat?.toLowerCase(), taxonomy); if (!item) { return null; }