Skip to content

Commit

Permalink
fix(core): respect isVisibleInNavigation for blog pages
Browse files Browse the repository at this point in the history
Fixes: #853
  • Loading branch information
chanceaclark committed May 6, 2024
1 parent 3b7ec09 commit eb37ed9
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/early-bananas-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bigcommerce/catalyst-core": patch
---

Respect isVisibleInNavigation for blog pages
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const PageQuery = graphql(
site {
content {
blog {
isVisibleInNavigation
post(entityId: $entityId) {
author
htmlBody
Expand Down
3 changes: 1 addition & 2 deletions apps/core/app/[locale]/(default)/blog/[blogId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ export default async function BlogPostPage({ params: { blogId, locale } }: Props

const data = await getPageData({ entityId: Number(blogId) });
const blogPost = data?.content.blog?.post;
const isVisibleInNavigation = data?.content.blog?.isVisibleInNavigation;

if (!blogPost || !isVisibleInNavigation) {
if (!blogPost) {
return notFound();
}

Expand Down
1 change: 0 additions & 1 deletion apps/core/app/[locale]/(default)/blog/page-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const BlogPostsPageQuery = graphql(
site {
content {
blog {
isVisibleInNavigation
name
posts(first: $first, after: $after, last: $last, before: $before, filters: $filters) {
edges {
Expand Down
2 changes: 1 addition & 1 deletion apps/core/app/[locale]/(default)/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default async function BlogPostPage({ params: { locale }, searchParams }:
const blogPosts = await getBlogPosts(searchParams);
const t = await getTranslations({ locale, namespace: 'Pagination' });

if (!blogPosts || !blogPosts.isVisibleInNavigation) {
if (!blogPosts) {
return notFound();
}

Expand Down
2 changes: 1 addition & 1 deletion apps/core/app/[locale]/(default)/blog/tag/[tagId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function BlogPostPage({ params: { tagId, locale }, searchPa
const blogPosts = await getBlogPosts({ tagId, ...searchParams });
const t = await getTranslations({ locale, namespace: 'Pagination' });

if (!blogPosts || !blogPosts.isVisibleInNavigation) {
if (!blogPosts) {
return notFound();
}

Expand Down

0 comments on commit eb37ed9

Please sign in to comment.