diff --git a/blocks/product-hero/product-hero.js b/blocks/product-hero/product-hero.js index de3ccff4..e062e9f3 100644 --- a/blocks/product-hero/product-hero.js +++ b/blocks/product-hero/product-hero.js @@ -6,6 +6,7 @@ import { getProductResponse, } from '../../scripts/commerce.js'; import { createOptimizedS7Picture, decorateModals } from '../../scripts/scripts.js'; +import { getMetadata } from '../../scripts/lib-franklin.js'; function showImage(e) { const selectedImage = document.querySelector('.image-content picture'); @@ -164,18 +165,17 @@ async function addToQuote(product) { export default async function decorate(block) { const titleEl = block.querySelector('h1'); + const h1Value = getMetadata('h1'); titleEl?.classList.add('title'); titleEl?.parentElement.parentElement.remove(); const response = await getProductResponse(); if (response?.length > 0) { - // Issue : 1311-products-title-metadata-fix - // document.title = response[0].Title ? response[0].Title : 'Danaher Product'; const allImages = response[0]?.raw.images; const verticalImageGallery = imageSlider(allImages, response[0]?.Title); const defaultContent = div(); defaultContent.innerHTML = response[0]?.raw.richdescription; defaultContent.prepend(span({ class: 'sku hidden' }, response[0]?.raw.productid)); - defaultContent.prepend(titleEl || h1({ class: 'title' }, response[0]?.Title)); + defaultContent.prepend(h1({ class: 'title' }, h1Value || response[0]?.raw.titlelsig)); defaultContent.prepend(span({ class: 'categories hidden' }, response[0]?.raw.categories)); defaultContent.prepend(span({ class: 'category-name' }, response[0]?.raw?.defaultcategoryname ? response[0]?.raw?.defaultcategoryname : '')); const rfqEl = block.querySelector(':scope > div:nth-child(1)');