commit 53a1e477915f81d27678e73b9d90f8debdb3cd2f
parent 076680a1993ae315a911e5fef6af0fafed23650c
Author: D <github@david.kitchen>
Date: Mon, 7 Nov 2022 13:25:36 +0000
[chore] Fix rel="nofollow" so that it only applies to external links (#991)
Resolves https://github.com/superseriousbusiness/gotosocial/issues/990
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/internal/text/sanitize.go b/internal/text/sanitize.go
@@ -33,7 +33,8 @@ import (
// Source: https://github.com/microcosm-cc/bluemonday#usage
var regular *bluemonday.Policy = bluemonday.UGCPolicy().
RequireNoReferrerOnLinks(true).
- RequireNoFollowOnLinks(true).
+ RequireNoFollowOnLinks(false). // remove the global default which adds rel="nofollow" to all links including local relative
+ RequireNoFollowOnFullyQualifiedLinks(true). // add rel="nofollow" on all external links
RequireCrossOriginAnonymous(true).
AddTargetBlankToFullyQualifiedLinks(true).
AllowAttrs("class", "href", "rel").OnElements("a").