Compare commits

..

2 Commits

Author SHA256 Message Date
200373e42f Merge develop into main 2025-07-27 23:23:24 +08:00
4d0ea1a55b Change index_view 200 into 20 2025-07-27 23:23:08 +08:00

View File

@@ -34,12 +34,12 @@ def index(request):
posts = posts.order_by('-publish_date').distinct() posts = posts.order_by('-publish_date').distinct()
# 为每篇文章添加摘要(前200个字符 # 为每篇文章添加摘要(前50个字符
for post in posts: for post in posts:
# 移除HTML标签并截取前200个字符作为摘要 # 移除HTML标签并截取前50个字符作为摘要
import re import re
clean_content = re.sub(r'<[^>]+>', '', post.get_markdown_content()) clean_content = re.sub(r'<[^>]+>', '', post.get_markdown_content())
post.summary = clean_content[:200] + '...' if len(clean_content) > 200 else clean_content post.summary = clean_content[:50] + '...' if len(clean_content) > 50 else clean_content
return render(request, 'blog/index.html', { return render(request, 'blog/index.html', {
'posts': posts, 'posts': posts,