diff --git a/blocks/event-summary/event-summary.js b/blocks/event-summary/event-summary.js index 38e01fa..6c533db 100644 --- a/blocks/event-summary/event-summary.js +++ b/blocks/event-summary/event-summary.js @@ -22,6 +22,7 @@ export default async function decorate(block) { const image = getMetadata('og:image'); const registerButton = getMetadata('register-button'); + const meetingButton = getMetadata('meeting-button'); const title = getMetadata('og:title'); const description = getMetadata('og:description'); const type = getMetadata('type'); @@ -56,11 +57,24 @@ export default async function decorate(block) { } else { registerButtonLink = a({ href: registerButton, title }, 'Register Today'); } - const registerButtonContainer = p({ class: 'button-container find-out-more' }, strong(registerButtonLink)); - const talkButtonContainer = p({ class: 'button-container' }, strong(a({ href: '/about-us/contact-us', title }, 'Request a Meeting/Contact Us'))); + + let registerButtonContainer; + if (registerButton) { + registerButtonContainer = p({ class: 'button-container find-out-more' }, strong(a({ href: registerButton, title }, 'Register Today'))); + } else { + registerButtonContainer = ''; + } + + let talkButtonContainer; + if (meetingButton) { + talkButtonContainer = p({ class: 'button-container' }, strong(a({ href: meetingButton, title }, 'Request a Meeting/Contact Us'))); + } else { + talkButtonContainer = ''; + } // Append elements to block block.appendChild(imageContainer); + block.appendChild(div({ class: 'event-details' }, eventDate, eventSubtitle, div({ class: 'event-keywords' }, keywordList), div({ class: 'event-description' }, eventSummary || description, registerButtonContainer, talkButtonContainer))); // Add event listener to the 'Register Today' button