{%- comment -%} Get post description or generate it from the post content. {%- endcomment -%} {%- assign max_length = include.max_length | default: 200 -%} {%- capture description -%} {%- if post.description -%} {{- post.description -}} {%- else -%} {% comment %} Remove the line number of the code snippet. {% endcomment %} {% assign content = post.content %} {% if content contains '
' %}
    {% assign content = content | replace: '
', '' %}
  {% endif %}

  {{- content | markdownify | strip_html | newline_to_br | replace: '
', ' ' | strip_newlines -}} {%- endif -%} {%- endcapture -%} {{- description | strip | truncate: max_length | escape -}}