Use dynamic current year in marketing email

_KG
Member

I would like to have year be a dynamic value in a marketing email. For an individual email, I am able to use the following HubL expression:

{{ local_dt|datetimeformat('%Y') }}

However, when I try to include it in a saved section or email template, the output value is saved (e.g. 2025) instead of the HubL expression.

 

Ideally, it would keep the HubL expression so the year updates dynamically whenever the section/template is used.

 

Is there another approach to this? If not, the ability to do this would be great.

1 Accepted solution
Karushna1
Solution
Top Contributor

You’re right @_KG, {{ local_dt|datetimeformat('%Y') }} works in an individual email, but HubSpot “freezes” it when you save it inside a section or template, so it turns into a static value like 2025 instead of staying dynamic. ​

 

I’d still use that HubL expression directly in the email body (not saved into a reusable section) wherever possible, so it stays dynamic when the email is actually sent.​

 

If your use case really needs it inside a saved section/template, HubSpot doesn’t currently give a clean built-in way to keep local_dt dynamic there, so a common workaround is to store a date or year in a custom property and reference that via a token (but that’s more of a hack than a perfect solution).​

 

For now, I’d suggest using the HubL directly in the specific email rather than inside the saved section, or testing a custom property approach if you really need reuse.​

 

If that still doesn’t solve it in your setup, let me know and I’ll dig into a more tailored workaround for you.

View solution in original post

0 Upvotes
3 Replies 3
HamdanAlzhori
Contributor

Content Remix doesn’t fully support applying your own branded templates directly. For landing pages, use an active theme with your Brand Kit and “Generate with AI” to align with your branding. For emails, start with your branded template, then use Content Remix to fill in content, and finish by applying your brand colors and any layout adjustments manually.

0 Upvotes
Victor_Becerra
Community Manager
Community Manager

Hi @_KG 
Thanks for bringing this question to the Community! This is a really thoughtful use case, and I can see why you’d want that year to update automatically instead of getting “locked in” when saving a section or template.

I’m going to tag in a few folks who work closely with HubL and email templates—they may have run into this before or found a good workaround. Hi @Karushna1 @Shubham_Sharma @Christensen - Would you be able to share any insights on this? Your expertise would be greatly appreciated.

Appreciate you raising this—features like this often start with questions just like yours.
Victor


loop Loop Marketing is a new four-stage approach that combines AI efficiency and human authenticity to drive growth.
Learn More

Karushna1
Solution
Top Contributor

You’re right @_KG, {{ local_dt|datetimeformat('%Y') }} works in an individual email, but HubSpot “freezes” it when you save it inside a section or template, so it turns into a static value like 2025 instead of staying dynamic. ​

 

I’d still use that HubL expression directly in the email body (not saved into a reusable section) wherever possible, so it stays dynamic when the email is actually sent.​

 

If your use case really needs it inside a saved section/template, HubSpot doesn’t currently give a clean built-in way to keep local_dt dynamic there, so a common workaround is to store a date or year in a custom property and reference that via a token (but that’s more of a hack than a perfect solution).​

 

For now, I’d suggest using the HubL directly in the specific email rather than inside the saved section, or testing a custom property approach if you really need reuse.​

 

If that still doesn’t solve it in your setup, let me know and I’ll dig into a more tailored workaround for you.

0 Upvotes