From 93484b1424ae21ae8bef25778033d4a89bd4dba9 Mon Sep 17 00:00:00 2001 From: gihnius Date: Fri, 21 Mar 2014 11:14:58 +0800 Subject: [PATCH] add nofollow ref for non internal links only --- html.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html.go b/html.go index b033489..7d7a0eb 100644 --- a/html.go +++ b/html.go @@ -415,7 +415,7 @@ func (options *Html) AutoLink(out *bytes.Buffer, link []byte, kind int) { } attrEscape(out, link) - if options.flags&HTML_NOFOLLOW_LINKS != 0 { + if options.flags&HTML_NOFOLLOW_LINKS != 0 && !isRelativeLink(link) { out.WriteString("\" rel=\"nofollow") } // blank target only add to external link @@ -510,7 +510,7 @@ func (options *Html) Link(out *bytes.Buffer, link []byte, title []byte, content out.WriteString("\" title=\"") attrEscape(out, title) } - if options.flags&HTML_NOFOLLOW_LINKS != 0 { + if options.flags&HTML_NOFOLLOW_LINKS != 0 && !isRelativeLink(link) { out.WriteString("\" rel=\"nofollow") } // blank target only add to external link