Skip to main content
Solved

Error when using template tags in universal content block

  • February 20, 2025
  • 2 replies
  • 13 views

Forum|alt.badge.img+2
  • Problem Solver I
  • 14 replies

I’m trying to create a universal content block of type html which includes a simple template tag in it: 

{% today \"%Y%m%d%H%M%S\" %}

However the api (I’m using the latest v2025-01-15) keeps giving me an invalid input error as follows:

{
  id: "a4c5b106-608d-4c8c-ad3a-27efaa2efc15",
  status: 400,
  code: "invalid",
  title: "Invalid input.",
  detail: "Attribute not allowed: app.editors.email_html_sanitizer.attribute('__close_django_tag__', )",
  source: {
    pointer: "/data/attributes/definition/data/content",
  },
  links: {
  },
  meta: {
  },
}

 

If I create the universal content block without this tag, it creates just fine and if I then afterwards go into the klaviyo ux and add the tag directly there, everything works fine and it runs properly and gives me the expected output:

 

It seems like the api’s sanitizer is simply preventing me from dropping this tag in there. Is there anyway around this or is there something I can do here? It is absolutely necessary for our specific application of universal content to be able to use template tags such as these to provide value to our clients. 

Thanks,

Mark

 

Best answer by obviyo

So I solved this one. Apparently the issue is related to how the parser is interpreting the date format that I’m passing in. It seems to mainly be an issue with the double quotes there. If I change those to single quotes then everything works fine and the api request for creation succeeds. So, to be clear, the tag looks like this: 

{% today '%Y%m%d%H%M%S' %}

View original
Did this topic or the replies in the thread help you find an answer to your question?

2 replies

Forum|alt.badge.img+2
  • Author
  • Problem Solver I
  • 14 replies
  • Answer
  • February 20, 2025

So I solved this one. Apparently the issue is related to how the parser is interpreting the date format that I’m passing in. It seems to mainly be an issue with the double quotes there. If I change those to single quotes then everything works fine and the api request for creation succeeds. So, to be clear, the tag looks like this: 

{% today '%Y%m%d%H%M%S' %}


emma.owens
Community Manager
Forum|alt.badge.img+13
  • Community Manager
  • 74 replies
  • February 21, 2025

Thank you for sharing this ​@obviyo ! So glad to hear you solved the issue. 

Here is our guide for inputting date personalization variables if you ever need it to reference: Date Personalization in templates reference