From dc28e54d47b346efc6408e05cacd7610fa87c335 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Tue, 26 Mar 2019 11:32:27 +0530 Subject: [PATCH] fix(blog_post): Fix for blog post having content as HTML (#7134) * fix: Handling for HTML content type * fix: use get_html_content_based_on_type for content * fix: fetch content_html and content_md --- frappe/website/doctype/blog_post/blog_post.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frappe/website/doctype/blog_post/blog_post.py b/frappe/website/doctype/blog_post/blog_post.py index fc6038c6a9..be1b3201ed 100644 --- a/frappe/website/doctype/blog_post/blog_post.py +++ b/frappe/website/doctype/blog_post/blog_post.py @@ -162,6 +162,9 @@ def get_blog_list(doctype, txt=None, filters=None, limit_start=0, limit_page_len t1.title, t1.name, t1.blog_category, t1.route, t1.published_on, t1.published_on as creation, t1.content as content, + t1.content_type as content_type, + t1.content_html as content_html, + t1.content_md as content_md, ifnull(t1.blog_intro, t1.content) as intro, t2.full_name, t2.avatar, t1.blogger, (select count(name) from `tabComment` @@ -182,9 +185,12 @@ def get_blog_list(doctype, txt=None, filters=None, limit_start=0, limit_page_len posts = frappe.db.sql(query, as_dict=1) for post in posts: + + post.content = get_html_content_based_on_type(post, 'content', post.content_type) post.cover_image = find_first_image(post.content) post.published = global_date_format(post.creation) - post.content = strip_html_tags(post.content[:340]) + post.content = strip_html_tags(post.content) + if not post.comments: post.comment_text = _('No comments yet') elif post.comments==1: