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

fix(core): respect isVisibleInNavigation for blog pages #854

Merged
merged 1 commit into from
May 6, 2024
Merged
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
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
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