From bc071c7dffb1b55ffc9ecaa4468a7f9d6cee7b9a Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 22 Jun 2021 15:15:11 -0400 Subject: [PATCH 1/5] remove homepage-specific version, no longer needed --- lib/path-utils.js | 2 +- lib/permalink.js | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/lib/path-utils.js b/lib/path-utils.js index 16da0545cf..e8fb6b6f3e 100644 --- a/lib/path-utils.js +++ b/lib/path-utils.js @@ -36,7 +36,7 @@ function getVersionStringFromPath (href) { // Return immediately if this is a link to the homepage if (href === '/') { - return 'homepage' + return nonEnterpriseDefaultVersion } // Get the first segment diff --git a/lib/permalink.js b/lib/permalink.js index 8eb391fb04..e15afe8989 100644 --- a/lib/permalink.js +++ b/lib/permalink.js @@ -2,7 +2,6 @@ const assert = require('assert') const path = require('path') const patterns = require('./patterns') const allVersions = require('./all-versions') -const nonEnterpriseDefaultVersion = require('./non-enterprise-default-version') const removeFPTFromPath = require('./remove-fpt-from-path') class Permalink { @@ -27,24 +26,10 @@ class Permalink { assert(languageCode, 'languageCode is required') const permalinks = applicableVersions - // skip the Dotcom homepage here because a special homepage permalink is added below - .filter(pageVersion => !(pageVersion === nonEnterpriseDefaultVersion && relativePath === 'index.md')) .map(pageVersion => { return new Permalink(languageCode, pageVersion, relativePath, title) }) - // special permalink for homepage - if (relativePath === 'index.md') { - const homepagePermalink = { - ...permalinks[0], - href: '/' + languageCode, - pageVersion: 'homepage', - pageVersionTitle: permalinks[0].title, - homepage: true - } - permalinks.push(homepagePermalink) - } - return permalinks } From 9839afa806a4965a10af265aa34685dd9fdcfd11 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 22 Jun 2021 15:15:30 -0400 Subject: [PATCH 2/5] this block is no longer used (unrelated to the homepage changes) --- middleware/context.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/middleware/context.js b/middleware/context.js index 42cfcfe168..35fc667425 100644 --- a/middleware/context.js +++ b/middleware/context.js @@ -52,13 +52,6 @@ module.exports = async function contextualize (req, res, next) { req.context.siteTree = siteTree req.context.pages = pageMap - // TODO we should create new data directories for these example files instead of using variable files - if (productMap[req.context.currentProduct]) { - req.context.productCodeExamples = req.context.site.data.variables[`${productMap[req.context.currentProduct].id}_code_examples`] - req.context.productCommunityExamples = req.context.site.data.variables[`${productMap[req.context.currentProduct].id}_community_examples`] - req.context.productUserExamples = req.context.site.data.variables[`${productMap[req.context.currentProduct].id}_user_examples`] - } - // JS + CSS asset paths req.context.builtAssets = builtAssets From 43c04966e5d16bce2a7cd06e58db325780924a60 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 22 Jun 2021 15:16:01 -0400 Subject: [PATCH 3/5] update React components that use the homepage version --- components/SidebarNav.tsx | 8 ++++---- components/article/ArticleVersionPicker.tsx | 4 ---- components/context/MainContext.tsx | 2 +- components/landing/HomepageVersionPicker.tsx | 13 ++----------- pages/index.tsx | 4 ++-- 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/components/SidebarNav.tsx b/components/SidebarNav.tsx index 1c95af0509..86e917ddaf 100644 --- a/components/SidebarNav.tsx +++ b/components/SidebarNav.tsx @@ -10,7 +10,7 @@ import { useVersion } from './hooks/useVersion' export const SidebarNav = () => { const router = useRouter() - const { error, relativePath, isHomepageVersion } = useMainContext() + const { error, relativePath } = useMainContext() const { t } = useTranslation('header') return ( @@ -39,7 +39,7 @@ export const SidebarNav = () => {