Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Removed any references to return active + documentation #62

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions components/core/Masthead/NavigationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
5 changes: 2 additions & 3 deletions components/core/Masthead/walkNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -91,7 +91,6 @@ export function enrichCmsEntries(cmsEntry: CmsHierarchyNode, categoriesById: any
hideProductList: false,
components: [],
slots: [],
active: true,
menu: {
hidden: false,
priority: generated * 10,
Expand Down
5 changes: 0 additions & 5 deletions docs/Blogs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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: {
Expand Down
4 changes: 0 additions & 4 deletions docs/DeepDive.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ let filterRequest: GetByFilterRequest =
{
path: "/_meta/schema",
value: "https://demostore.amplience.com/content/store"
},
{
path: "/filterActive",
value: true
}
],
sortBy: {
Expand Down
29 changes: 15 additions & 14 deletions docs/WorkingWithPages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -20,29 +20,30 @@ 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

> Note: When categories are set to automatically draw from commerce, they are given their priority with increments of 10 so that you can mix and max dynamic and curated navigation.

> 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.

Expand Down
4 changes: 0 additions & 4 deletions pages/blog-filter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions pages/category/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
{
Expand Down
4 changes: 2 additions & 2 deletions pages/content/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion pages/page/[...slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 0 additions & 4 deletions pages/product/[...keys].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 0 additions & 8 deletions pages/store/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
Loading