修复文章摘要截取错误

This commit is contained in:
liangliangyy
2017-06-08 14:30:20 +08:00
parent 42f3b4697a
commit f6e75f8060
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -71,9 +71,9 @@ def truncatechars_content(content):
@register.filter(is_safe=True)
@stringfilter
def truncate(content):
from django.template.defaultfilters import truncatechars
from django.utils.html import strip_tags
return truncatechars(content, 150)
return strip_tags(content)[:150]
@register.inclusion_tag('blog/tags/breadcrumb.html')
+1 -1
View File
@@ -38,7 +38,7 @@
<div class="entry-content" itemprop="articleBody">
{% if isindex %}
{{ article.body|truncatechars_content|custom_markdown }}
{{ article.body|custom_markdown|truncatechars_content }}
<p class='read-more'><a
href=' {{ article.get_absolute_url }}'>Read more</a></p>
{% else %}