- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Change background image based on a contact's industry?
SOLVESep 19, 2017 11:56 AM - edited Sep 19, 2017 12:06 PM
I have the following bit of code for a hero image in my template:
{% image "background_image" label='Select a background image', export_to_template_context=True %} <style> .hero { background-image:url("{{widget_data.background_image.src }}"); background-repeat: no-repeat; background-position: center center; background-size: cover; } </style>
I'm wondering if there is a way to make the background image different based on a contact's (company's) Industry.
Is there a way to us HubL if statements for a company's industry?
Basically something like:
If a company's industry is LOGISTICS, <style> .hero { background: a custom image for logistics companies; } </style> else <style> .hero { background-image:url("{{widget_data.background_image.src }}"); </style>
Any help is greatly appreciated.
Thank you very much!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Accepted Solutions
Sep 19, 2017 1:57 PM
You have the right idea! You can pretty much do exactly that if statement. Formatted with HubL, It would look something like this:
{% if company.industry == "Logistics" %} <style> .hero { background: a custom image for logistics companies; } </style> {% else %} <style> .hero { background-image:url("{{widget_data.background_image.src }}"); </style> {% endif %}
I'd recommend checking out this doc on HubL if statements.
http://designers.hubspot.com/docs/hubl/if-statements
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content