Skip to content

Commit

Permalink
MWPW-136469 Fix authored tag link (#1362)
Browse files Browse the repository at this point in the history
* MWPW-136469 Fix authored tag link

* remove extra lines
  • Loading branch information
meganthecoder authored Oct 2, 2023
1 parent 4acd182 commit 22f7056
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libs/scripts/taxonomy.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async function fetchTaxonomy(target) {
return fetch(target).then((response) => response.json());
}

function parseTaxonomyJson(data, root) {
function parseTaxonomyJson(data, root, route) {
let level1; let level2;
return data?.reduce((taxonomy, row) => {
const level3 = removeLineBreaks(row[TAXONOMY_FIELDS.level3]);
Expand All @@ -94,7 +94,7 @@ function parseTaxonomyJson(data, root) {
? new URL([row[TAXONOMY_FIELDS.link]])
: generateUri(name);
const path = taxLink.pathname
? taxLink.pathname?.replace('.html', '').split('/topics/').pop()
? taxLink.pathname?.replace('.html', '').split(`${route}/`).pop()
: taxLink;
const link = `${root}/${path}`;
const hidden = !!row[TAXONOMY_FIELDS.hidden]?.trim();
Expand Down Expand Up @@ -164,7 +164,7 @@ export default async (config, route, target) => {

return fetchTaxonomy(path)
.then((json) => {
const taxonomy = parseTaxonomyJson(json.data, root);
const taxonomy = parseTaxonomyJson(json.data, root, route);

return {
CATEGORIES,
Expand Down

0 comments on commit 22f7056

Please sign in to comment.