From 290dd4dfd16883f4ef3a2267891c2a7194baedc2 Mon Sep 17 00:00:00 2001 From: Neil Mistry <30687441+neilmistryamplience@users.noreply.github.com> Date: Thu, 2 May 2024 16:33:32 +0100 Subject: [PATCH 1/2] feat: Removed any references to return active + documentation --- components/core/Masthead/NavigationContext.tsx | 3 --- components/core/Masthead/walkNavigation.tsx | 5 ++--- docs/Blogs.md | 5 ----- docs/DeepDive.md | 4 ---- pages/blog-filter/index.tsx | 4 ---- pages/category/[slug].tsx | 4 ---- pages/content/[...slug].tsx | 4 ++-- pages/page/[...slug].tsx | 2 +- pages/product/[...keys].tsx | 4 ---- pages/store/index.tsx | 8 -------- 10 files changed, 5 insertions(+), 38 deletions(-) diff --git a/components/core/Masthead/NavigationContext.tsx b/components/core/Masthead/NavigationContext.tsx index 2ed7dee4..13efce90 100644 --- a/components/core/Masthead/NavigationContext.tsx +++ b/components/core/Masthead/NavigationContext.tsx @@ -149,9 +149,6 @@ export const WithNavigationContext = ({ pages, categories, children }: WithNavig if (!type) { return null; } - if (!node.content?.active) { - return null; - } switch (type) { case 'category': let category = categoriesById[node.content.name]; diff --git a/components/core/Masthead/walkNavigation.tsx b/components/core/Masthead/walkNavigation.tsx index c78d75ba..2b6e6cd3 100644 --- a/components/core/Masthead/walkNavigation.tsx +++ b/components/core/Masthead/walkNavigation.tsx @@ -4,7 +4,7 @@ import { NavigationItem } from './NavigationContext'; export default function walkNavigation( current: NavigationItem, visitor: (item: NavigationItem, parents: NavigationItem[]) => void, - parents: NavigationItem[] = [] + parents: NavigationItem[] = [], ) { visitor(current, parents); for (let child of current.children) { @@ -14,7 +14,7 @@ export default function walkNavigation( export function walkNavigationItems( items: NavigationItem[], - visitor: (item: NavigationItem, parents: NavigationItem[]) => void + visitor: (item: NavigationItem, parents: NavigationItem[]) => void, ) { for (let item of items) { walkNavigation(item, visitor); @@ -91,7 +91,6 @@ export function enrichCmsEntries(cmsEntry: CmsHierarchyNode, categoriesById: any hideProductList: false, components: [], slots: [], - active: true, menu: { hidden: false, priority: generated * 10, diff --git a/docs/Blogs.md b/docs/Blogs.md index 1d9bfaf1..a9406f38 100644 --- a/docs/Blogs.md +++ b/docs/Blogs.md @@ -10,7 +10,6 @@ This demostore contains 2 technical methods for listing blog posts in the applic Blog posts from Amplience are also configured to be returned from the Filter API. This allows retrieval by: - Content Type Schema -- Active And also being able to sort the blog posts by the following attributes in ascending and descending order: @@ -41,10 +40,6 @@ async function getAllBlogs(context:CmsContext, next_cursor = null, order = 'desc { path: '/_meta/schema', value: 'https://demostore.amplience.com/content/blog', - }, - { - path: '/active', - value: true } ], sortBy: { diff --git a/docs/DeepDive.md b/docs/DeepDive.md index 44204e24..845d0ce7 100644 --- a/docs/DeepDive.md +++ b/docs/DeepDive.md @@ -73,10 +73,6 @@ let filterRequest: GetByFilterRequest = { path: "/_meta/schema", value: "https://demostore.amplience.com/content/store" - }, - { - path: "/filterActive", - value: true } ], sortBy: { diff --git a/pages/blog-filter/index.tsx b/pages/blog-filter/index.tsx index 28d61ac9..22ce0e82 100644 --- a/pages/blog-filter/index.tsx +++ b/pages/blog-filter/index.tsx @@ -17,10 +17,6 @@ async function fetchBlogs(context: CmsContext, options: { key?: string; order?: path: '/_meta/schema', value: 'https://demostore.amplience.com/content/blog', }, - { - path: '/active', - value: true, - }, ], sortBy: { key, diff --git a/pages/category/[slug].tsx b/pages/category/[slug].tsx index 7377670e..fb0a6035 100644 --- a/pages/category/[slug].tsx +++ b/pages/category/[slug].tsx @@ -57,10 +57,6 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { return create404Error(data, context); } - if (data.content.page && !data.content.page.active) { - data.content.page = null; - } - slug = Array.isArray(slug) ? slug.join('/') : slug; const props = await fetchPageData( { diff --git a/pages/content/[...slug].tsx b/pages/content/[...slug].tsx index 4ea96cde..9d60ffb7 100644 --- a/pages/content/[...slug].tsx +++ b/pages/content/[...slug].tsx @@ -14,10 +14,10 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { page: { key: `content/${deliveryKey}` }, }, }, - context + context, ); - if (!data.page || !data.content.page?.active) { + if (!data.page) { return create404Error(data, context); } diff --git a/pages/page/[...slug].tsx b/pages/page/[...slug].tsx index 3e32eeb4..82c665ee 100644 --- a/pages/page/[...slug].tsx +++ b/pages/page/[...slug].tsx @@ -20,7 +20,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { context, ); - if (!data.page || !data.content.page?.active) { + if (!data.page) { return create404Error(data, context); } diff --git a/pages/product/[...keys].tsx b/pages/product/[...keys].tsx index 18a8afaf..24700ee8 100644 --- a/pages/product/[...keys].tsx +++ b/pages/product/[...keys].tsx @@ -51,10 +51,6 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { return create404Error(data, context); } - if (!data.content.productContent?.active) { - data.content.productContent = null; - } - const experienceConfigRequests: GetByFilterRequest[] = []; // config based on category diff --git a/pages/store/index.tsx b/pages/store/index.tsx index f4284a52..b96065d4 100644 --- a/pages/store/index.tsx +++ b/pages/store/index.tsx @@ -17,10 +17,6 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { path: '/_meta/schema', value: 'https://demostore.amplience.com/content/store', }, - { - path: '/filterActive', - value: true, - }, ], sortBy: { key: 'default', @@ -65,10 +61,6 @@ export default function StoreMainPage({ storesData, content }: InferGetServerSid path: '/_meta/schema', value: 'https://demostore.amplience.com/content/store', }, - { - path: '/filterActive', - value: true, - }, ], sortBy: { key: 'default', From 34b5f1a4b2e3b7b8e95e8b011205a33d2723ef0b Mon Sep 17 00:00:00 2001 From: Neil Mistry <30687441+neilmistryamplience@users.noreply.github.com> Date: Fri, 3 May 2024 07:07:54 +0100 Subject: [PATCH 2/2] docs: removal of active flag --- docs/WorkingWithPages.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/WorkingWithPages.md b/docs/WorkingWithPages.md index eee6d607..ed74f2bf 100644 --- a/docs/WorkingWithPages.md +++ b/docs/WorkingWithPages.md @@ -4,13 +4,13 @@ The concepts of pages are a key demonstrable area of Demostore. They exist in 2 ### Navigation: -- **Category Page** - An item & page linked to a Commerce category (PLP) -- **Landing Page** - An item and standalone page for content only -- **External Page** - An item which has an external link for its page content +- **Category Page** - An item & page linked to a Commerce category (PLP) +- **Landing Page** - An item and standalone page for content only +- **External Page** - An item which has an external link for its page content ### Standalone: -- **Content Page** - A page which can be used by itself without being in the menu. +- **Content Page** - A page which can be used by itself without being in the menu. ## Ordering in Navigation @@ -20,8 +20,8 @@ Example: 0 will be first The priority is in relation to other priorities set at the same at the same level in the hierarchy. So for example if you have 2 nodes at the same level -- MyItemA [Priority set to 50] -- MyItemB [Priority set to 10] +- MyItemA [Priority set to 50] +- MyItemB [Priority set to 10] Will display as `MyItemB,MyItemA` in that order @@ -29,20 +29,21 @@ Will display as `MyItemB,MyItemA` in that order > Additional node: If items have the same priority, they will display in order of which they are returned from the API. - ## Hiding a page -Each of these content types has a flag in the content form called `is Active` which defaults to true. -If you disable this, then the page is no longer visible if attempting to visit it directly or in the menu navigation. +To hide a page that has not yet been published, archive it. +To hide a published page simply unpublish it. + +> Note: Unpublishing can take up to 5 minutes to be removed from delivery cache. ## Archiving a page & delivery keys + Best practice when archiving a page is to follow the steps below: -1) Set the page to not be active & save - a) If the page was previously published then republish. -2) Change the delivery key to something random & save - b) Delivery keys are mandatory so you can use the same path and append a unique id using an online tool such as [Short UUID Generator](https://generateuuid.online/short-uuid). Example `category/6vYaP46nCukXc2DPTpnXZP` -3) If the page is part of the navigation and already published, you should also remove the node and republish so that the parent link is no longer attached. See [Removing a node from a hierachy](https://amplience.com/developers/docs/dev-tools/guides-tutorials/hierarchies/#removing-a-node-from-a-hierarchy) +1. Unpublish the page. +2. Change the delivery key to something random & save + b) Delivery keys are mandatory so you can use the same path and append a unique id using an online tool such as [Short UUID Generator](https://generateuuid.online/short-uuid). Example `category/6vYaP46nCukXc2DPTpnXZP` +3. If the page is part of the navigation and already published, you should also remove the node. See [Removing a node from a hierachy](https://amplience.com/developers/docs/dev-tools/guides-tutorials/hierarchies/#removing-a-node-from-a-hierarchy) This will ensure that your content is not still visible when removed and your delivery key can be re-used again.