# Intelligent trunctation

**URL:** <https://zola.discourse.group/t/intelligent-trunctation/1152>\
**Category:** Uncategorized\
**Created:** [January 24, 2022, 9:31pm UTC](https://zola.discourse.group/t/intelligent-trunctation/1152 "2022-01-24T21:31:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phillord](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/phillord/32/652_2.png) [@phillord](https://zola.discourse.group/u/phillord)\
**Post date:** [January 24, 2022, 9:31pm UTC](https://zola.discourse.group/t/intelligent-trunctation/1152/1 "2022-01-24T21:31:37Z")

</div>

I would like to use produce summaries of my posts so that I can display them in brief on sections. I have found `page.summary` which does what I want but requires manual markup on my posts. That’s possible but as I am porting an existing blog it’s quite a lot of effort. I’ve also tried the `truncate` filter. That works okay, but only truncates as a string – not something that is HTML aware. So, if it truncates in the middle of a tag, then we end up with broken HTML.

I can work around this, since I am producing the CommonMark that zola acts on via pandoc, but it would seem a bit neater to do this in zola. Is there a context aware method of breaking HTML into bits to produce an approximately sized summary without manual markup?

---

<div class="post-metadata">

**Author:** ![dustinknopoff](https://avatars.discourse-cdn.com/v4/letter/d/f08c70/32.png) [@dustinknopoff](https://zola.discourse.group/u/dustinknopoff)\
**Post date:** [January 25, 2022, 11:38am UTC](https://zola.discourse.group/t/intelligent-trunctation/1152/2 "2022-01-25T11:38:59Z")

</div>

I have done the same by calling strip tags first

`{{ page.content | striptags | truncate }}`

Though I agree being able to keep styling would be nice

---

<div class="post-metadata">

**Author:** ![phillord](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/phillord/32/652_2.png) [@phillord](https://zola.discourse.group/u/phillord)\
**Post date:** [January 25, 2022, 9:30pm UTC](https://zola.discourse.group/t/intelligent-trunctation/1152/3 "2022-01-25T21:30:27Z")

</div>

Thanks! That is not a bad alternative.
