<?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: Passing a custom variable to index page template in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Passing-a-custom-variable-to-index-page-template/m-p/1010117#M39875</link>
    <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/792769"&gt;@FMesina&lt;/a&gt;&amp;nbsp;- I'm not entirely sure I follow the logic of what you are trying to achive here, but my eye is drawn to the statement&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;{% text "display_date" value=effective_date, export_to_template_context=True %}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;which will take the module text field 'display_date' out of the normal evaluation flow and position it as a value settable by the page editor when editing the post. Is that part of the logic you want - or is there anothe reason for the export_to_template designation?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Jul 2024 17:29:53 GMT</pubDate>
    <dc:creator>SteveHTM</dc:creator>
    <dc:date>2024-07-15T17:29:53Z</dc:date>
    <item>
      <title>Passing a custom variable to index page template</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Passing-a-custom-variable-to-index-page-template/m-p/1009647#M39872</link>
      <description>&lt;P&gt;I have this in the blog post page template. Basically it should be able to detect the custom page update date that will be use as sorting date of the post in the index page. I am having trouble passing variable effective_date as value.&lt;BR /&gt;&lt;BR /&gt;~~~&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{% set effective_date = content.publish_date %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{% if module.show_custom_update_date %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; {% set effective_date = module.updated_date %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{% endif %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;{% text "display_date" value=effective_date, export_to_template_context=True %}&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;"article-heading-banner"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;h1&lt;/SPAN&gt; &lt;SPAN&gt;class&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"article-title"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;{{content.title}}&lt;/SPAN&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;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;p&lt;/SPAN&gt; &lt;SPAN&gt;class&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"article-details"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;a&lt;/SPAN&gt; &lt;SPAN&gt;href&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"{{ blog_author_url(group.id, content.blog_post_author.slug) }}"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;{{ content.blog_post_author.display_name }}&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;a&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt; | Published &lt;/SPAN&gt;&lt;SPAN&gt;&amp;amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;{{ content.publish_date | format_date('MMMM dd, yyyy') }}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {% if module.show_custom_update_date %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {% set update_time = content.updated %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | Updated {{ module.updated_date | format_date('MMMM dd, yyyy') }}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {% endif %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;p&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;&lt;SPAN&gt;&amp;gt;&lt;BR /&gt;~~~&lt;BR /&gt;&lt;BR /&gt;This is what I see in the developer info. I am seeing&amp;nbsp; "value": "effective_date", instead of the date.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;      "type_name": "text",
      "type": "text",
      "name": "module_172082412025471_effective_date",
      "parent_name": "module_172082412025471",
      "label": null,
      "line_number": 6,
      "params": {
        "parent_widget_container": null,
        "tag": "text",
        "type": "text",
        "value": "effective_date",
        "export_to_template_context": true,
        "content_editable_values": [
          "value"
        ],
        "overrideable": true
      },&lt;/PRE&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;How can I pass the variable date to index template. Thank you.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 14 Jul 2024 22:41:38 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Passing-a-custom-variable-to-index-page-template/m-p/1009647#M39872</guid>
      <dc:creator>FMesina</dc:creator>
      <dc:date>2024-07-14T22:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a custom variable to index page template</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Passing-a-custom-variable-to-index-page-template/m-p/1010117#M39875</link>
      <description>&lt;P&gt;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/792769"&gt;@FMesina&lt;/a&gt;&amp;nbsp;- I'm not entirely sure I follow the logic of what you are trying to achive here, but my eye is drawn to the statement&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;{% text "display_date" value=effective_date, export_to_template_context=True %}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;which will take the module text field 'display_date' out of the normal evaluation flow and position it as a value settable by the page editor when editing the post. Is that part of the logic you want - or is there anothe reason for the export_to_template designation?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 17:29:53 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Passing-a-custom-variable-to-index-page-template/m-p/1010117#M39875</guid>
      <dc:creator>SteveHTM</dc:creator>
      <dc:date>2024-07-15T17:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Passing a custom variable to index page template</title>
      <link>https://community.hubspot.com/t5/CMS-Development/Passing-a-custom-variable-to-index-page-template/m-p/1010119#M39876</link>
      <description>&lt;P&gt;Sorry I have not explained it clearly. I would like to set a custom date on a the post that will be use in the index the page for sorting by date.&lt;BR /&gt;&lt;BR /&gt;It will either be the publish date&lt;BR /&gt;{% set effective_date = content.publish_date %}&lt;BR /&gt;&lt;BR /&gt;or a custom update date if enabled and set by the user.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{% if module.show_custom_update_date %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; {% set effective_date = module.updated_date %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;{% endif %}&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;Once set in the post. I will use it as sorting reference in the index template.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; {% set sorted_contents = contents|sort(attribute='effective_date', true) %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; {% for content in sorted_contents %}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;How can I have the data available in the index template?&amp;nbsp;&lt;BR /&gt;I am trying to do this line but the value shows as effective_date not the actual date that should be passed.&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;{% text "display_date" value=effective_date, export_to_template_context=True %}&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2024 17:50:05 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/CMS-Development/Passing-a-custom-variable-to-index-page-template/m-p/1010119#M39876</guid>
      <dc:creator>FMesina</dc:creator>
      <dc:date>2024-07-15T17:50:05Z</dc:date>
    </item>
  </channel>
</rss>

