Skip to content

Instantly share code, notes, and snippets.

@raftastrock
Created April 3, 2018 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raftastrock/36206f2086c58025bccbf1163b362b0d to your computer and use it in GitHub Desktop.
Save raftastrock/36206f2086c58025bccbf1163b362b0d to your computer and use it in GitHub Desktop.
Bento Template with options for video background (freemarker)
<div class="bento block-container no-padding ">
<#list block.siblings as block>
<#assign image_info = "" />
<#assign video_image_info = "" />
<#assign video_info = "" />
<#list block.media.siblings?reverse as cur_media>
<#if cur_media.video_type.data?has_content>
<#assign video_info = video_info + "<source src='" + cur_media.data + "' type='" + cur_media.video_type.data + "'>" />
<#elseif cur_media.data?has_content>
<#assign image_info = image_info + "background-image: url(" + cur_media.data + ");" />
<#assign video_image_info = video_image_info + "<img src='" + cur_media.data + "' >" />
</#if>
</#list>
<#assign bento_section_css = "bento-section bento-section-${block_index + 1} block ${block.background_color.data} ${block.width.data} ${block.block_class.data}" />
<#assign bento_section_style = "" />
<#if video_info?has_content && !browserSniffer.isMobile(http_servlet_request) && !browserSniffer.isIe(http_servlet_request)>
<#assign bento_section_css = bento_section_css + " video-banner" />
<#else>
<#assign bento_section_style = "style='${image_info}'" />
</#if>
<div class="${bento_section_css}" ${bento_section_style} ${block.data}>
<#if video_info?has_content && !browserSniffer.isMobile(http_servlet_request) && !browserSniffer.isIe(http_servlet_request)>
<video autoplay class="background-video" height="100%" loop muted width="100%">
${video_info}
${video_image_info}
</video>
</#if>
<#if block.article_url_title?has_content>
<#list block.article_url_title.siblings as article_url_title>
<@article_utilities.embed_journal_article_by_url_title article_url_title.data />
</#list>
</#if>
</div>
</#list>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment