Skip to content

Commit

Permalink
Merge pull request #2460 from graphcommerce-org/fix/breadcrumbs
Browse files Browse the repository at this point in the history
Respect breadcrumbs config on blog pages
  • Loading branch information
paales authored Dec 20, 2024
2 parents 337204b + d8ec6a8 commit 1b5322d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-rocks-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphcommerce/magento-graphcms': patch
---

Respect breadcrumbs config on blog pages
32 changes: 17 additions & 15 deletions examples/magento-graphcms/pages/blog/[...url].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,21 +47,23 @@ function BlogPage(props: Props) {
{title}
</LayoutTitle>
</LayoutHeader>
<Container maxWidth={false}>
<Breadcrumbs
sx={(theme) => ({
mx: theme.page.horizontal,
mb: theme.spacings.sm,
[theme.breakpoints.down('md')]: {
'& .MuiBreadcrumbs-ol': { justifyContent: 'center' },
},
})}
breadcrumbs={[
{ href: '/blog', name: i18n._(/* i18n*/ 'Blog') },
{ href: `/${page.url}`, name: title },
]}
/>
</Container>
{import.meta.graphCommerce.breadcrumbs && (
<Container maxWidth={false}>
<Breadcrumbs
sx={(theme) => ({
mx: theme.page.horizontal,
mb: theme.spacings.sm,
[theme.breakpoints.down('md')]: {
'& .MuiBreadcrumbs-ol': { justifyContent: 'center' },
},
})}
breadcrumbs={[
{ href: '/blog', name: i18n._(/* i18n*/ 'Blog') },
{ href: `/${page.url}`, name: title },
]}
/>
</Container>
)}
<Row>
<PageMeta title={title} metaDescription={title} canonical={`/${page.url}`} />

Expand Down
4 changes: 3 additions & 1 deletion examples/magento-graphcms/pages/blog/page/[page].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ function BlogPage(props: Props) {
</LayoutHeader>

<Container maxWidth={false}>
<Breadcrumbs breadcrumbs={[{ href: `/${page.url}`, name: title }]} />
{import.meta.graphCommerce.breadcrumbs && (
<Breadcrumbs breadcrumbs={[{ href: `/${page.url}`, name: title }]} />
)}
<LayoutTitle variant='h1'>{title}</LayoutTitle>
</Container>

Expand Down

0 comments on commit 1b5322d

Please sign in to comment.