From e906874b2ed2b337864103bf3b654178650a059f Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Wed, 13 Nov 2024 21:59:53 +0800 Subject: [PATCH] :sparkles: Count content length when truncate --- pkg/internal/services/posts.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/internal/services/posts.go b/pkg/internal/services/posts.go index e4c6dd8..0920af5 100644 --- a/pkg/internal/services/posts.go +++ b/pkg/internal/services/posts.go @@ -481,6 +481,7 @@ func TruncatePostContent(post models.Post) models.Post { post.Body["content"] = string([]rune(val)[:length]) + "..." post.Body["content_truncated"] = true } + post.Body["content_length"] = len([]rune(val)) } }