Skip to content

Commit

Permalink
MWPW-138106: b.a.com Blog category titles fix (#1472)
Browse files Browse the repository at this point in the history
* First

* Adding some string sanatization to taxonomy

* Removing console.log

* Adjusting based on CR
  • Loading branch information
JasonHowellSlavin authored Nov 6, 2023
1 parent 33ce518 commit da807bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion libs/blocks/recommended-articles/recommended-articles.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions libs/scripts/taxonomy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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; }

Expand Down

0 comments on commit da807bd

Please sign in to comment.