MCPcopy
hub / github.com/ampproject/amphtml / getLiveBlogItem

Function getLiveBlogItem

build-system/server/app.js:700–755  ·  view source on GitHub ↗

* @return {string}

()

Source from the content-addressed store, hash-verified

698 * @return {string}
699 */
700function getLiveBlogItem() {
701 const now = Date.now();
702 // Generate a 3 to 7 worded headline
703 const headline = bacon(range(3, 7));
704 const numOfParagraphs = range(1, 2);
705 const body = Array.apply(null, new Array(numOfParagraphs))
706 .map(() => {
707 return `<p>${bacon(range(50, 90))}</p>`;
708 })
709 .join('\n');
710
711 const img = `<amp-img
712 src="${
713 flip()
714 ? 'https://placekitten.com/300/350'
715 : 'https://baconmockup.com/300/350'
716 }"
717 layout="responsive"
718 height="300" width="350">
719 </amp-img>`;
720 return `<!doctype html>
721 <html amp><body>
722 <amp-live-list id="live-blog-1">
723 <div items>
724 <div id="live-blog-item-${now}" data-sort-time="${now}">
725 <h3 class="headline">
726 <a href="#live-blog-item-${now}">${headline}</a>
727 </h3>
728 <div class="author">
729 <div class="byline">
730 <p>
731 by <span itemscope itemtype="http://schema.org/Person"
732 itemprop="author"><b>Lorem Ipsum</b>
733 <a class="mailto" href="mailto:lorem.ipsum@">
734 lorem.ipsum@</a></span>
735 </p>
736 <p class="brand">PublisherName News Reporter<p>
737 <p><span itemscope itemtype="http://schema.org/Date"
738 itemprop="Date">
739 ${new Date(now).toString().replace(/ GMT.*$/, '')}
740 <span></p>
741 </div>
742 </div>
743 <div class="article-body">${body}</div>
744 ${img}
745 <div class="social-box">
746 <amp-social-share type="facebook"
747 data-param-text="Hello world"
748 data-param-href="https://example.test/?ref=URL"
749 data-param-app_id="145634995501895"></amp-social-share>
750 <amp-social-share type="twitter"></amp-social-share>
751 </div>
752 </div>
753 </div>
754 </amp-live-list></body></html>`;
755}
756
757/**

Callers 1

app.jsFile · 0.85

Calls 6

rangeFunction · 0.85
flipFunction · 0.85
nowMethod · 0.80
applyMethod · 0.80
replaceMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected