What is Dynamic Content?
Dynamic Content is a feature in Digital Agent that allows the users to use information stored in our databases as part of the piece of content they are writing. This information can be used as part of the content itself or inside logic blocks to create if-else conditions and loops that will shape that content.
With this feature enables, not only, users to create future-proof content (ex, if they use this to expose their phone number, whenever that number changes in their profile, the content will be automatically updated), but also marketing users to create 'one-size fits all' contents, that will be populated with the information from the website that is using that piece.
How to Use
Our Dynamic Content renderer is built on top of a template engine called Jinja, meaning that as long as you are following their specification, DA will be able to render your content.
Just insert Jinja markup in the middle of your content and let the application handles it for you.
Jinja
Jinja2 is a full featured template engine for Python. It has full Unicode support, an optional integrated sandboxed execution environment, widely used and BSD licensed.
To learn more about Jinja and its syntax, read the official documentation in http://jinja.pocoo.org
What are the fields I can use?
Since every field that could be used needs to be explicitly exposed in our application, currently, we have a limited set of fields that are currently available. These fields are:
Office
Since every website is related to a single Office, this a simple object, with the following fields:
Addresses
An array of Addresses that are related to this Office. This object has the following properties: line1, line2, city, state (also used for province), country, postalCode (also used for Zip Codes).
IMPORTANT: All addresses attached to that Office will be present in this array. Make sure to check if this is the primary address.
Ex:{% for address in office.addresses %} {% if address.primary %} {{address.line1}} {{address.line2}}, {{address.city}} {{address.state}} {% endif %} {% endfor %}
Alternatively, you can target the specific index of the address you are trying to get (NOTE: THIS DOES NOT GUARANTEE THE PRIMARY ADDRESS):
Address Line 1: {{office.addresses[0].line1}} Address Line 2: {{office.addresses[0].line2}} City: {{office.addresses[0].city}} Province: {{office.addresses[0].state}} Postal Code: {{office.addresses[0].postalCode}} Country: {{office.addresses[0].line2}}
Phones
An array of the Phones attached to this Office. Every Phone is composed of three fields: type, number and extension.
IMPORTANT: Just like Addresses, this array does not have a specific order in its elements, so if you need to use its elements, you need to check against its type. Type can be: Phone, Cell, Fax, Toll-Free
Ex:{% for phone in office.phones %} {% if phone.type == 'Phone' %} <a class="no-link-style" href="tel:{{phone.number}}"><span class="bts bt-phone margin-right-5"></span>{{phone.number}} {% if phone.extension != '' %} Ext. {{phone.extension}} {% endif %}</a> {% endif %} {% endfor %}
Email
A string representing the Office's email.
Ex:<a href="mailto:{{office.email}}">Contact me</a>
Name
A string representing the Office's name.
Ex:{{office.name}}
Website URL
A string representing the Office's website URL.
Ex:<a href="{{office.websiteUrl}}">Click here</a> to go to our website.
Office Type
A string representing the Office's type. It can be one of the following: INDIVIDUAL, TEAM, BRANCH, REGION.
Ex:If you want to hear more from {% if office.officeType == "INDIVIDUAL" %}me{% else %}us{% endif %}, subscribe in {% if office.officeType == "INDIVIDUAL" %>my{% else %}our{% endif %} newsletter.
Photo & LogoThis returns the ID of the file representing this object. To use it you need to manually create the src URL of the image object you are defining. This URL should follow the pattern ../../delegate/services/file/ID/content.
Photo
This ID represents the Office Photo defined in Office Profile.
Ex:<img src="../../delegate/services/file/{{office.photo}}/content" />
Logo (NOTE: This feature is not enabled for every tenant, they might not have it.)
This ID represents the Office Logo defined in Office Profile.
Ex:<img src="../../delegate/services/file/{{office.logo}}/content" />
Social MediaA string representing the Office's social media URL.
Available fields:Facebook
Ex:
{% if office.facebook != "" %}<a href="{{office.facebook}}">Follow us on Facebook</a>{% endif %}
Linkedin
Ex:
{% if office.linkedin != "" %} <a href="{{office.linkedin}}">Check our Linkedin</a> {% endif %}
Twitter
Ex:
{% if office.twitter != "" %} <a href="{{office.twitter}}">Follow us on Twitter</a> {% endif %}
Youtube
Ex:
{% if office.youtube != "" %} <a href="{{office.youtube}}">Follow us on Youtube</a> {% endif %}
NOTE: Like the Office Logo, this feature is not enabled equally in all tenants, meaning the fields being present is a tenant configuration.
Parent Office
Parent office attribute was added to enhance dynamic content possibilities within Digital Agent, to make sure clients can get more information from all levels of Organizational Gropus. (to understand more review the organizational groups tree in DA).
Now user can use officeParent variable the same way as office variable to get the information from the top tier of the OG tree.
Example:
Phones
An array of the Phones attached to this Parent Office. Every Phone is composed of three fields: type, number and extension.
IMPORTANT: Just like Addresses, this array does not have a specific order in its elements, so if you need to use its elements, you need to check against its type. Type can be: Phone, Cell, Fax, Toll-Free
Ex:{% for phone in officeParent.phones %} {% if phone.type == 'Phone' %} <a class="no-link-style" href="tel:{{phone.number}}"><span class="bts bt-phone margin-right-5"></span>{{phone.number}} {% if phone.extension != '' %} Ext. {{phone.extension}} {% endif %}</a> {% endif %} {% endfor %}
Profile
Unlike Office, each website can contain multiples profiles (one per each Team Member in that Office), meaning that this is an array of objects instead of a single object. You can iterate over it to use each profile.
NOTE: Contrary to Phones and Addresses, this array respect a particular order (the display order defined in the Team Members section) therefore its elements are in a predictable position.
NameSince we keep first name and last name in separate fields in our database, those fields are exposed in two different ways: each field per se and composition of those two together.
First Name
A string representing the Profile's first name.
Ex:{{profiles[0].first_name}}
Last Name
A string representing the Profile's last name.
Ex:{{profiles[0].last_name}}
Full Name
A string representing the Profile's full name (a composition of First Name and Last Name separated by an empty space).
Ex:<h2>Our advisors:</h2> <ul> {% for profile in profiles %} <li>{{profile.full_name}}</li> {% endfor %} </ul>
Email
A string representing the Profile's email.
Ex:<a href="mailto:{{profiles[0].email}}">Contact me</a>
Job Title
A string representing the Profile's Job Title.
Depending on tenant you can retrieve job_title, job_title1 and job_title2.
Ex:{{profiles[0].job_title}}
Biography
HTML representing the Profile's Biography.
Ex:{{profiles[0].biography}}
Designations
A string representing a list of the Profile's Designations.
Ex:{{profiles[0].designations}}
Licenses
A string representing a list of the Profile's Licenses.
Ex:{{profiles[0].licenses}}
Phones
An array of the Phones attached to this Office. Every Phone is composed of three fields: type, number and extension.
IMPORTANT: Just like Office Addresses and Office Phones, this array does not have a specific order in its elements, so if you need to use its elements, you need to check against its type. Type can be Phone, Cell, Fax, Toll-Free.
Ex:{% for phone in profile[0].phones %} {% if phone.type == 'Phone' %} <a class="no-link-style" href="tel:{{phone.number}}"><span class="bts bt-phone margin-right-5"></span>{{phone.number}} {% if phone.extension != '' %} Ext. {{phone.extension}} {% endif %}</a> {% endif %} {% endfor %}
Social MediaA string representing the Profile's social media URL.
Available fields:Facebook
Ex:
{% if profiles[0].facebook != "" %} <a href="{{profiles[0].facebook}}">Follow us on Facebook</a> {% endif %}
Linkedin
Ex:
{% if profiles[0].linkedin != "" %} <a href="{{profiles[0].linkedin}}">Follow us on Linkedin</a> {% endif %}
Twitter
Ex:
{% if profiles[0].twitter != "" %} <a href="{{profiles[0].twitter}}">Follow us on Twitter</a> {% endif %}
Youtube
Ex:
{% if profiles[0].youtube != "" %} <a href="{{profiles[0].youtube}}">Follow us on Youtube</a> {% endif %}
NOTE: Like the Office Logo and Office Social Media, this feature is not enabled equally in all tenants, meaning the fields being present is a tenant configuration.
Profile Picture
This ID represents the profile picture.
NOTE: Like Office Photo and Office Logo, this returns the ID of the file representing this object. To use it you need to manually create the src URL of the image object you are defining. This URL should follow the pattern ../../delegate/services/file/ID/content.
Ex:<img src="../../delegate/services/file/{{profile[0].photo}}/content" />
Where can I use it?
WebContent
Updates
Widgets
BlogPosts
Disclosures
Usage example
|
Dynamic Content: Team Member Profiles:
How to use in footer disclosure setting :
Suppose you have a list of multiple team members, and you only want to display some of them. You can achieve this by providing the indices of the team members you want to print in the footer.
Example -
team member array = [1,2,3,4,5]
Here are some dynamic variables you can add to the footer disclosure settings:
Variable List:
{{numberOfTeamMembersToPrint}} []
{{teamMemberAdvisorName}}
{{teamMemberJobTitle}}
{{teamMemberProvinces}}
{{teamMemberPhones}}
{{teamMemberFacebookURL}}
{{teamMemberLinkedinURL}}
{{teamMemberTwitterURL}}
{{teamMemberEmail}}
To print only the 2nd and 5th team members, just provide these numbers in the array.
Example -
<p> {{numberOfTeamMembersToPrint}} - [2,5] </p>
<p>TEAM MEMBER NAME - {{teamMemberAdvisorName}} </p>
<p> JOB TITLE - {{teamMemberJobTitle}} </p>
<p>PROVINCES- {{teamMemberProvinces}} </p>
<p>PHONE - {{teamMemberPhones}} </p>
<p>FACEBOOK_URL - {{teamMemberFacebookURL}} </p>
<p>LINKEDIN_URL - {{teamMemberLinkedinURL}} </p>
<p>TWITTER_URL - {{teamMemberTwitterURL}} </p>
<p>EMAIL - {{teamMemberEmail}} </p>
<hr>
By providing these numbers in the array, it will display only the 2nd and 5th team members in the footer.
If you want to display all team members, just pass an empty array.
Example -
<p>{{numberOfTeamMembersToPrint}} - []</p>
If you pass an empty array, it will print all team members.
NOTE - Just to clarify, a user can only add one configuration at a time either as a primary user details or as a team members details. If both configurations are added simultaneously, it will not work.
EXAMPLE -
Primary User Details | Team Members Details | |
---|---|---|
{{advisorName}} {{provinces}} {{branchName}} {{jobTitle}} {{officeAddress}} {{phones}} {{facebook}} {{linkedin}} {{twitter}} {{email}} | OR | {{numberOfTeamMembersToPrint}} - [] {{teamMemberJobTitle}} {{teamMemberProvinces}} {{teamMemberPhones}} |
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article