Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

fix(untranslated-ckg-pills): metadata key fix & CKG pill altText logic fix #939

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions express/scripts/ckg-link-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function fetchLinkList() {
}

function matchCKGResult(ckgData, pageData) {
const ckgMatch = pageData.ckgID === ckgData.ckgID;
const ckgMatch = pageData.ckgid === ckgData.ckgID;
const pageDataTasks = pageData.tasks ?? pageData.templateTasks;
const taskMatch = ckgData.tasks?.toLowerCase() === pageDataTasks?.toLowerCase();
const currentLocale = getLocale(window.location);
Expand Down Expand Up @@ -150,15 +150,15 @@ async function updateLinkList(container, linkPill, list) {

if (pillsMapping) {
const alternateText = pillsMapping.find((row) => window.location.pathname === `${urlPrefix}${row['Express SEO URL']}` && d.ckgID === row['CKG Pill ID']);

if (alternateText && alternateText[`${localeColumnString}`]) {
const hasAlternateTextForLocale = alternateText && alternateText[`${localeColumnString}`];
if (hasAlternateTextForLocale) {
displayText = alternateText[`${localeColumnString}`];
if (templatePageData) {
templatePageData.altShortTitle = displayText;
}
}

hideUntranslatedPill = !displayText && locale !== 'us';
hideUntranslatedPill = !hasAlternateTextForLocale && locale !== 'us';
}

if (templatePageData) {
Expand Down