Skip to content
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
3 changes: 2 additions & 1 deletion packages/template-retail-react-app/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
- Replace transfer basket call with merge basket on checkout [#2138](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2138)
- [BUG] Fix images being fetced multiple times on Safari [#2223](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2223)
- Support Node 22 [#2218](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2218)

tags
- PDP / PLP: Add page meta data tags that have been defined in BM [#2232](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2232)

### Accessibility Improvements
- [a11y] Fix LinkList component to follow a11y practise [#2098])(https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2098)
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the meta title be consistent with the content of the <title> tag, or default to product.pageTitle if the meta title is not provided?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike with description, the title meta tag and page title do appear to be different. (It seems that the title meta tag is generated based on the page title, the price, and the site id?)

I think using the page title as the title is more straightforward as what you enter in BM is what you'll get with no extras added.

Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ const ProductDetail = () => {
'prices',
'variations',
'set_products',
'bundled_products'
'bundled_products',
'page_meta_tags'
],
allImages: true
}
Expand Down Expand Up @@ -455,7 +456,15 @@ const ProductDetail = () => {
>
<Helmet>
<title>{product?.pageTitle}</title>
<meta name="description" content={product?.pageDescription} />
{product?.pageMetaTags?.length > 0 &&
product.pageMetaTags.map(({id, value}) => (
<meta name={id} content={value} key={id} />
))}
{/* Fallback for description if not included in pageMetaTags */}
{!product?.pageMetaTags?.some((tag) => tag.id === 'description') &&
product?.pageDescription && (
<meta name="description" content={product.pageDescription} />
)}
</Helmet>

<Stack spacing={16}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,14 @@ const ProductList = (props) => {
perPricebook: true,
allVariationProperties: true,
allImages: true,
expand: ['promotions', 'variations', 'prices', 'images', 'custom_properties'],
expand: [
'promotions',
'variations',
'prices',
'images',
'page_meta_tags',
'custom_properties'
],
refine: _refine
}
},
Expand Down Expand Up @@ -411,6 +418,9 @@ const ProductList = (props) => {
<title>{category?.pageTitle ?? searchQuery}</title>
<meta name="description" content={category?.pageDescription ?? searchQuery} />
<meta name="keywords" content={category?.pageKeywords} />
{productSearchResult?.pageMetaTags?.map(({id, value}) => {
return <meta name={id} content={value} key={id} />
})}
</Helmet>
{showNoResults ? (
<EmptySearchResults searchQuery={searchQuery} category={category} />
Expand Down
Loading