aboutsummaryrefslogtreecommitdiffstats
path: root/post
diff options
context:
space:
mode:
Diffstat (limited to 'post')
-rw-r--r--post/post.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/post/post.go b/post/post.go
index 1561161..7fa7e90 100644
--- a/post/post.go
+++ b/post/post.go
@@ -51,6 +51,9 @@ type Post struct {
// Content with sources and references resolved to absolute URLs
AbsoluteContent string
+ // AbsoluteContent with sanitizing for RSS feeds
+ SafeContent string
+
// Content HTML tags removed
PlainText string
@@ -196,7 +199,12 @@ func (p *Post) parse() {
//
p.Content = string(p.Filter([]byte(p.Text)))
p.AbsoluteContent = render.ResolveURLs(p.Content, p.Site.GetURL())
- policy := bluemonday.StrictPolicy()
+
+ policy := bluemonday.UGCPolicy()
+ policy.RequireNoFollowOnLinks(false)
+ p.SafeContent = policy.Sanitize(p.AbsoluteContent)
+
+ policy = bluemonday.StrictPolicy()
p.PlainText = policy.Sanitize(p.Content)
p.PlainText = strings.Replace(p.PlainText, "\n\n", "\n", -1)
p.PlainText = strings.Replace(p.PlainText, " ", " ", -1)