Skip to content

Commit

Permalink
Merge pull request #1328 from hlxsites/1311-products-title-metadata-fix
Browse files Browse the repository at this point in the history
1311 products title metadata fix
  • Loading branch information
davenichols-DHLS authored Dec 13, 2024
2 parents 0997f09 + 058d80a commit 0deef94
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions blocks/product-hero/product-hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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)');
Expand Down

0 comments on commit 0deef94

Please sign in to comment.