mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 06:00:25 +03:00
Add a BlackFriday option for rel="noreferrer" on external links
Add a configuration option "noreferrerLinks". When set to "true" the "HTML_NOREFERRER_LINKS" flag is being passed to Blackfriday. Thereby all *absolute* links will get a "noreferrer" value for their "rel" attribute. See #4722
This commit is contained in:
parent
2174525cec
commit
20cbc2c785
3 changed files with 13 additions and 0 deletions
|
@ -109,6 +109,7 @@ type BlackFriday struct {
|
|||
Fractions bool
|
||||
HrefTargetBlank bool
|
||||
NofollowLinks bool
|
||||
NoreferrerLinks bool
|
||||
SmartDashes bool
|
||||
LatexDashes bool
|
||||
TaskLists bool
|
||||
|
@ -126,6 +127,7 @@ func newBlackfriday(config map[string]interface{}) *BlackFriday {
|
|||
"fractions": true,
|
||||
"hrefTargetBlank": false,
|
||||
"nofollowLinks": false,
|
||||
"noreferrerLinks": false,
|
||||
"smartDashes": true,
|
||||
"latexDashes": true,
|
||||
"plainIDAnchors": true,
|
||||
|
@ -283,6 +285,10 @@ func (c *ContentSpec) getHTMLRenderer(defaultFlags int, ctx *RenderingContext) b
|
|||
htmlFlags |= blackfriday.HTML_NOFOLLOW_LINKS
|
||||
}
|
||||
|
||||
if ctx.Config.NoreferrerLinks {
|
||||
htmlFlags |= blackfriday.HTML_NOREFERRER_LINKS
|
||||
}
|
||||
|
||||
if ctx.Config.SmartDashes {
|
||||
htmlFlags |= blackfriday.HTML_SMARTYPANTS_DASHES
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue