Skip to content

Commit

Permalink
[chore] Fix rel="nofollow" so that it only applies to external links (#…
Browse files Browse the repository at this point in the history
…991)

Resolves #990
  • Loading branch information
buro9 committed Nov 7, 2022
1 parent 076680a commit 53a1e47
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/text/sanitize.go
Original file line number Diff line number Diff line change
Expand Up @@ -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").
Expand Down

0 comments on commit 53a1e47

Please sign in to comment.