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

Commit

Permalink
Merge pull request #925 from wbstry/temp-v2-release-fix
Browse files Browse the repository at this point in the history
Temp v2 release fix
  • Loading branch information
JingleH authored Jun 26, 2023
2 parents 6d1a09c + d2b89b6 commit 24d45bd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
6 changes: 3 additions & 3 deletions express/scripts/all-templates-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ export default async function fetchAllTemplatesMetadata() {
let sheet;

if (['yes', 'true', 'on'].includes(dev) && env?.name === 'stage') {
sheet = '/templates-dev.json?sheet=seo-templates&limit=10000';
sheet = '/templates-dev.json?sheet=seo-templates&limit=100000';
} else {
sheet = `${urlPrefix}/express/templates/default/metadata.json?limit=10000`;
sheet = `${urlPrefix}/express/templates/default/metadata.json?limit=100000`;
}

let resp = await memoizedFetchUrl(sheet);
allTemplatesMetadata = resp?.data;

// TODO: remove the > 1 logic after publishing of the split metadata sheet
if (!(allTemplatesMetadata && allTemplatesMetadata.length > 1)) {
resp = await memoizedFetchUrl('/express/templates/content.json?sheet=seo-templates&limit=10000');
resp = await memoizedFetchUrl('/express/templates/content.json?sheet=seo-templates&limit=100000');
allTemplatesMetadata = resp?.data?.map((p) => ({
...p,
// TODO: backward compatibility. Remove when we move away from helix-seo-templates
Expand Down
13 changes: 13 additions & 0 deletions express/scripts/content-replace.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ await (async function updateMetadataForTemplates() {
const templateList = document.querySelector('.template-list.fullwidth.apipowered');
const templateX = document.querySelector('.template-x');
const browseByCat = document.querySelector('.browse-by-category');
const seoNav = document.querySelector('.seo-nav');

if (templateList) {
await replaceDefaultPlaceholders(templateList);
Expand All @@ -187,6 +188,18 @@ await (async function updateMetadataForTemplates() {
await replaceDefaultPlaceholders(templateX);
}

if (seoNav) {
if (getMetadata('top-templates-title')) {
seoNav.innerHTML = seoNav.innerHTML.replace('Default top templates title', getMetadata('top-templates-title'));
}

if (getMetadata('top-templates-text')) {
seoNav.innerHTML = seoNav.innerHTML.replace('Default top templates text', getMetadata('top-templates-text'));
} else {
seoNav.innerHTML = seoNav.innerHTML.replace('Default top templates text', '');
}
}

if (browseByCat && !['yes', 'true', 'on', 'Y'].includes(getMetadata('show-browse-by-category'))) {
browseByCat.remove();
}
Expand Down
6 changes: 3 additions & 3 deletions express/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1773,13 +1773,13 @@ export async function fetchFloatingCta(path) {
}

if (['yes', 'true', 'on'].includes(dev) && env && env.name === 'stage') {
spreadsheet = '/express/floating-cta-dev.json?limit=10000';
spreadsheet = '/express/floating-cta-dev.json?limit=100000';
} else {
spreadsheet = '/express/floating-cta.json?limit=10000';
spreadsheet = '/express/floating-cta.json?limit=100000';
}

if (experimentStatus === 'active') {
const expSheet = '/express/experiments/floating-cta-experiments.json?limit=10000';
const expSheet = '/express/experiments/floating-cta-experiments.json?limit=100000';
floatingBtnData = await fetchFloatingBtnData(expSheet);
}

Expand Down

0 comments on commit 24d45bd

Please sign in to comment.