diff --git a/blocks/talk-detail-before-outline/talk-detail-before-outline.js b/blocks/talk-detail-before-outline/talk-detail-before-outline.js index 64a3ff8..6c8067d 100644 --- a/blocks/talk-detail-before-outline/talk-detail-before-outline.js +++ b/blocks/talk-detail-before-outline/talk-detail-before-outline.js @@ -58,6 +58,13 @@ function buildVideo(parent) { loadBlocks(parent); } +/** + * @returns true if any "p" or "li" element is found in the default content. + */ +function isOutlinePresent() { + return document.querySelectorAll('main .default-content-wrapper p, main .default-content-wrapper li').length > 0; +} + /** * Talk detail before outline: Tags, time info and video. * @param {Element} block @@ -75,5 +82,7 @@ export default async function decorate(block) { buildTimeInfo(block, scheduleEntry); } buildVideo(block); - append(block, 'h4').textContent = 'Outline'; + if (isOutlinePresent()) { + append(block, 'h4').textContent = 'Outline'; + } }