How do I trigger autoplay in a video field in Hubspot? - html

Using Hubspot and under Marketing -> Files and Templates -> Design Tools:
I am using a video in a Template called promo_video. Also, using the copy_snippet produces the code below to be used in module.html.
{% if module.promo_video.player_id %}
{% set max_width = module.promo_video.size_type == 'auto_custom_max' ? module.promo_video.max_width : module.promo_video.width %}
{% set max_height = module.promo_video.size_type == 'auto_custom_max' ? module.promo_video.max_height : module.promo_video.height %}
{% video_player "embed_player"
player_id={{ module.promo_video.player_id }}
type={{ module.promo_video.player_type || 'scriptV4' }}
full_width={{ module.promo_video.size_type == 'auto_full_width' }},
conversion_asset={{ module.promo_video.conversion_asset|tojson|safe }}
autoplay={{ module.promo_video.autoplay }}
hidden_controls={{ module.promo_video.hide_controls }}
loop={{ module.promo_video.loop_video }}
muted={{ module.promo_video.mute_by_default }}
%}
{% endif %}
How do I automatically turn on autoplay for the video in it's page? (video stars when the page loads)
I tried to add "allow" to the line below but the video does not autoplay:
autoplay={{ module.promo_video.autoplay }}
below is a portion of the video in its webpage

Related

Ignore HTML line in Django Template

I am new to Django. That's why I am a bit confused. and I am not sure is it possible or not?
{% for appoint in appoints %}
{% if appoint.a_status == 'Pending' %}
<h4>Pending</h4>
<p>{{appoint}}###Accept###Reject</p?>
{% elif appoint.a_status == 'Accept' %}
<h4>Accepted</h4>
<p>{{appoint}}###Done###Reject</p?>
{% elif appoint.a_status == 'Done' %}
<h4>Done</h4>
<p>{{appoint}}</p?>
{% else %}
<h4>Reject</h4>
<p>{{appoint}}</p?>
{% endif %}
{% endfor %}
This is part of a template. I want to ignore Django attribute/code to ignore the h4 tag. I know I can do this something by running loop for every h4 tag. but that will less efficient.

An if-statement based on src HTML

I have big html document with various images with href and src.
I want to make an if statement based on the output of the src.
<img class="img-fluid d-block w-100" src="/static/assets/img/{{ LANGUAGE_CODE }}/actionFlow({% if form.status.value|slugify == '1'%}taak-toegewezen{% else %}{{form.status.value|slugify}}{%endif%}).png" id="workflowVisual">
Example outputs can be:
"/static/assets/img/en/actionFlow(taak-toegewezen).png"
"/static/assets/img/en/actionFlow(firststep).png"
Now, I want to create an if statement like so:
{% if src== "/static/assets/img/en/actionFlow(taak-toegewezen).png"}{{instance.reviewer2}}
{% else src== "/static/assets/img/en/actionFlow(firststep).png"}{{instance.reviewer1}}{%endif%}
How do I do this in HTML?
Best,
Rob
You seem to use django templating, which is not just HTML.
You can set variables using {% with variable = 1 %}:
{% if form.status.value|slugify == '1' %}
{% with SLUG = 'taak-toegewezen' %}
{% else %}
{% with SLUG = form.status.value|slugify %}
{% endif %}
{% with imgSrc = "/static/assets/img/"|addstr:LANGUAGE_CODE|addstr:"/actionFlow("|addstr:SLUG|addstr:").png" %}
And now it's way easier to use in a if statement.
{% if imgSrc == "/static/assets/img/en/actionFlow(taak-toegewezen).png" %}
{{instance.reviewer2 }}
{% else if imgSrc == "/static/assets/img/en/actionFlow(firststep).png" %}
{{instance.reviewer1 }}
{% else %}
Default value
{% endif %}

Bolt cms putting showcases online

I'm currently trying to get a showcase to be displayed on bolt, but the textarea and files are not displayed. What am I doing wrong?
Here's the part of the code used for placing content on the page
{% block main %}
{% if app.request.uri == 'http://zernikedecanaat.esy.es/over-ons.html' %}
{% setcontent page = 'page/1' %}
{% elseif app.request.uri == 'http://genericsite/1' %}
{% setcontent page = 'page/2' %}
{% elseif app.request.uri == 'http://genericsite/2' %}
{% setcontent page = 'page/3' %}
{% elseif app.request.uri == 'http://genericsite/3' %}
{% setcontent page = 'showcase/3' %}
{% elseif app.request.uri == 'http://genericsite/4' %}
{% setcontent page = 'showcase/1' %}
{% elseif app.request.uri == 'http://genericsite/5' %}
{% setcontent page = 'showcase/2' %}
{% endif %}
<p><h1>{{ page.title }}</h1></p></br>
<p>{{ page.teaser }}</p></br>
<p>{{ page.html }}</p></br>
<p>{{ page.textarea }}</p></br>
<p>{{ page.file }}</p></br>
<p>{{ popup(page.image, 1200, 500) }}</p></br>
<p>{{ page.body }}</p></br>
{% for file in filelist %}
{{ page.file }}
{% endfor %}
{% endblock main %}
It works fine when the contenttype is a page. Titles, teasers, images and the body appears. With showcases only the html area and the title show on the site.

Shopify Liquid capture settings not outputting for some reason

I'm trying to get and display some theme settings which gets the site name and applies to end which i have setup in the schema but cant get it to display the settings.
In the promo_header.liquid snippet file i have:
{% capture promo_header_text_1 %} locale_promo_1_text_{{ shop.name }} {% endcapture %}
{% capture promo_header_url_1 %} locale_promo_1_url_{{ shop.name }} {% endcapture %}
{% capture promo_header_text_2 %} locale_promo_2_text_{{ shop.name }} {% endcapture %}
{% capture promo_header_url_2 %} locale_promo_2_url_{{ shop.name }} {% endcapture %}
<p>
{% if settings[promo_header_text_1] %}
{{ settings[promo_header_text_1] }}
{% endif %}
{% if settings[promo_header_text_2] %}
<span>/</span>{{ settings[promo_header_text_2] }}
{% endif %}
</p>
I have also tried to output using just for example
{{ settings.promo_header_text_1 }}
But not displaying anything either... when i debug and display for example
{{ promo_header_text_1 }}
It does return
locale_promo_1_text_website-test2
Which is correct and in the schema settings file (example based on that one above it is matching and is set in theme customisation)
{
"type": "text",
"id": "locale_promo_1_text_website-test2",
"label": "Promo 1 Text",
"default": "FREE US SHIPPING OVER $35"
}
What am I doing wrong?
For anyone else that might come across the same issue here is the solution I got working:
{% assign promo_header_text_1 = 'locale_promo_1_text_' | append:shop.name %}
and to output
{{ settings[promo_header_text_1] }}

Check for existence of file using Jekyll

How can I use Jekyll to test for the existence of a file?
To clarify, I want to run an {% if %} statement to check if an image file exists with the same name as the page I am on.
On my page in the YAML front matter:
----
reference-design: true
----
In my layout:
{% if page.reference-design %}
{% assign filename = page.path | remove_first: '.html' %}
<!-- How can I check if file actually exists? -->
<img src="images/reference_designs/{{ filename }}.png">
{% endif %}
As of Jekyll 2, all site files are available via site.static_files. You can use this to check if a file exists. For example:
{% for static_file in site.static_files %}
{% if static_file.path == '/favicon.ico' %}
{% assign favicon = true %}
{% endif %}
{% endfor %}
I had a similar problem to solve, but specifically looking for videos that matched the a specific directory / filename based on the markdown file.
Using file.size allowed me to test if the file (actually) exists.
{% for video in site.video-demos %}
{% assign path = page.id | replace: page.slug , "" | prepend: '/assets/media/video' | append: video.directory | append: page.slug | append: ".mp4" %}
{% assign file_exists = site.static_files | where: "path", path %}
{% if file_exists.size != 0 %}
{% include video-player.html filename = path title = video.title %}
{% endif %}
{% endfor %}
It loops through an array from my config to get part of the directory structure:
video-demos:
- title: iOS Voiceover Safari
directory: ios/
- title: Android Talkback Chrome
directory: android/
- title: Windows Jaws Chrome
directory: jaws/
- title: Windows NVDA Chrome
directory: nvda/
- title: MacOS Voiceover Safari
directory: macos/
This plugin worked for me: https://github.com/Wolfr/jekyll_file_exists
After you install it, you can use it like:
{% if page.reference-design %}
{% assign filename = page.path | remove_first: '.html' %}
{% capture img_exists %}{% file_exists {{ filename }}.png %}{% endcapture %}
{% if img_exists == "true" %}
<img src="images/reference_designs/{{ filename }}.png">
{% endif %}
{% endif %}
Read http://ecommerce.shopify.com/c/ecommerce-design/t/testing-if-a-file-exists-29624. Also you might be able to play with capture.