<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Set background image using export_to_template_context in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1054050#M40956</link>
    <description>&lt;P&gt;the second &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-10-12 at 21-12-39 Template.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/129145iA6A6C1F1DBDA0B71/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-10-12 at 21-12-39 Template.png" alt="Screenshot 2024-10-12 at 21-12-39 Template.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 12 Oct 2024 19:19:57 GMT</pubDate>
    <dc:creator>POfficial90</dc:creator>
    <dc:date>2024-10-12T19:19:57Z</dc:date>
    <item>
      <title>Set background image using export_to_template_context</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1051505#M40898</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to allow a user to set the background image for the post hero using the "export_to_template_context" parameter as detailed here&amp;nbsp;&lt;A href="https://developers.hubspot.com/docs/cms/building-blocks/modules/export-to-template-context#user-selectable-background-images" target="_blank"&gt;https://developers.hubspot.com/docs/cms/building-blocks/modules/export-to-template-context#user-selectable-background-images&lt;/A&gt;&amp;nbsp;but the image is not being outputted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I'm using in the template:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{% module "hero_image" path='@hubspot/image', label='Select a hero image', src='&lt;A href="https://placehold.co/2000x600" target="_blank"&gt;https://placehold.co/2000x600&lt;/A&gt;', export_to_template_context=True %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;{% extends "./base.html" %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;{% block body %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;div&lt;/SPAN&gt; &lt;SPAN&gt;class&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"Block Block--hero"&lt;/SPAN&gt; &lt;SPAN&gt;style&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;background-image:url('{{ widget_data.hero_image.src }}');"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;div&lt;/SPAN&gt; &lt;SPAN&gt;class&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"container"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;h1&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{{ page_meta.name }}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;h1&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;div&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;div&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;{{ content.post_body }}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;{% endblock body %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;I'm not sure where I've gone wrong so any help is greatly appreciated.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Ryan&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 08 Oct 2024 09:35:29 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1051505#M40898</guid>
      <dc:creator>RAnderson91</dc:creator>
      <dc:date>2024-10-08T09:35:29Z</dc:date>
    </item>
    <item>
      <title>Re: Set background image using export_to_template_context</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1051677#M40902</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/832699"&gt;@RAnderson91&lt;/a&gt;&amp;nbsp;- I've done a comparison of your code snippet with the one that I'm using operationally (and have done for many years).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only difference I can see is that my instance of the module is inside the {% block body %} structure. I also son't use a default src value, but I can't see that as significant.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck - its a powerful technique to master!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Steve&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 14:28:25 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1051677#M40902</guid>
      <dc:creator>SteveHTM</dc:creator>
      <dc:date>2024-10-08T14:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: Set background image using export_to_template_context</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1051734#M40903</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/63499"&gt;@SteveHTM&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response, after moving the module inside the body tag as you suggested it still wouldn't output.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added a standard text module and managed to output that value in both the post template and listing template.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I managed to see all the info by using&amp;nbsp;{{ widget_data.hero_image }} in the template, which outputted the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{img={src=&lt;A href="https://static.hubspot.com/final/img/content/email-template-images/placeholder_200x200.png" target="_blank"&gt;https://static.hubspot.com/final/img/content/email-template-images/placeholder_200x200.png&lt;/A&gt;, alt=placeholder_200x200, loading=disabled, width=200, height=200}, link=, parent_widget_container=null, label=Select a hero image, smart_type=NOT_SMART, type=module, export_to_template_context=true, target=false, field_types={link=text, img=image, target=boolean}, path=@hubspot/linked_image, definition_id=null, module_id=1155231, extra_classes=widget-type-linked_image, wrap_field_tag=div, smart_objects=[]}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So then after changing my source to&amp;nbsp;{{ widget_data.hero_image.img.src }} I was finally able to get the image to output as I wanted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if this is how it is supposed to work and the documentation is out of date or I have done something different elsewhere in my theme but just wanted to type all this out in case someone else encounters the same issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 15:34:00 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1051734#M40903</guid>
      <dc:creator>RAnderson91</dc:creator>
      <dc:date>2024-10-08T15:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Set background image using export_to_template_context</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1054048#M40955</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="a" style="width: 566px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/129144i5811551709974F80/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-10-12 at 21-12-39 Template.png" alt="a" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;a&lt;/span&gt;&lt;/span&gt;the picture&lt;/P&gt;</description>
      <pubDate>Sat, 12 Oct 2024 19:18:15 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1054048#M40955</guid>
      <dc:creator>POfficial90</dc:creator>
      <dc:date>2024-10-12T19:18:15Z</dc:date>
    </item>
    <item>
      <title>Re: Set background image using export_to_template_context</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1054050#M40956</link>
      <description>&lt;P&gt;the second &lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-10-12 at 21-12-39 Template.png" style="width: 999px;"&gt;&lt;img src="https://community.hubspot.com/t5/image/serverpage/image-id/129145iA6A6C1F1DBDA0B71/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-10-12 at 21-12-39 Template.png" alt="Screenshot 2024-10-12 at 21-12-39 Template.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Oct 2024 19:19:57 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Set-background-image-using-export-to-template-context/m-p/1054050#M40956</guid>
      <dc:creator>POfficial90</dc:creator>
      <dc:date>2024-10-12T19:19:57Z</dc:date>
    </item>
  </channel>
</rss>

