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

1311 products title metadata fix #1328

Merged
merged 5 commits into from
Dec 13, 2024
Merged
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
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
Loading