Recent searches


No recent searches

Using Liquid markup to customize the formatting and placement of text in comments and email notifications



image avatar

Aimee Spanier

Zendesk Documentation Team

Edited Dec 20, 2024


6

11

11 comments

Here is a related article that might also be relevant: Setting up an unformatted email template

Thank you Aimee!

0


Fyi, if you're looking for information about how to do visual formatting / styles with Liquid markup, it's just plain html.

To bold something: <b>bold</b>

To make something into a heading: <h1>heading</h1>

0


This was incredibly helpful! Thank you!

1


Hi there, Aimee Spanier

 

Is there a way to clean up this markup 

{% for comment in ticket.comments %}

 

Comment:

{{comment.created_at}}

{{comment.created_at_with_time}}

{{comment.author.name}}

{{comment.value}}

 

Attachment:

{% for attachment in comment.attachments %}

{{attachment.filename}}

{{attachment.url}}

 

{% endfor %}

 

{% endfor %}

 

to only include the URL's for all the attachments in public comments but not the comments? The above returns all comments without an attachment as well and I'm having trouble editing it. 

Thanks!

 

1


Hi,

And thanks for the article.

Is there a way to pass the text so it is formatted like a ticket and not just text?

I am creating a forwarding email and would like to replicate the ticket but send it to a different requester.

0


image avatar

Zsa Trias

Zendesk Customer Care

Hello Carly,

You may want to check this article on how you can customize your email template: Customizing your email templates for notifications
 

0


Jed Hollander  MS Copilot said this about your question. 

Sure, I can help with that. If you only want to include the URLs for all the attachments in public comments and not the comments themselves, you can modify your code to look like this:

{% for comment in ticket.comments %}
  {% for attachment in comment.attachments %}
    {{attachment.url}}
  {% endfor %}
{% endfor %}

This will loop through all the comments and their attachments, but only print out the URLs of the attachments. It will not print out any information about the comments themselves or any attachments without a URL. This should give you a cleaner output with only the information you want.

0


im trying to change the {{comment.author.name}}, if the author is an agent, it would be a fix name, but when its an end user it would be as their name on zendesk, if there a way to do it ? 

0


image avatar

Vlad

The Wise One - 2022Community Moderator

Hey Vicky, have you tried like:

 

{{#if author.agent}}

fixed name

{{else}}

 {{author.name}}

{{/if}}

 

0


Vlad 
It works at the beginning, but when the end user replied, it still shows the Fixed name, and the content all mixed together, 
the below is what i had 


{% for comment in ticket.comments %}
<hr/>
{{#if author.agent}}
<b>Fix Name</b>
{{else}}
{{author.name}}
{{/if}}
<span style="color: #999999;"> {{comment.created_at_with_time}}<br /></span>
{{comment.value}}

{% endfor %}
 

0


Hi, I think I wasn't clear in my last comment.

In sted of {{comment.value}} I need something like {{ticket.comment_html_body}}

This way, it is formatted correctly and will display images and more.

how do I do this?

1


Please sign in to leave a comment.