-
-
Notifications
You must be signed in to change notification settings - Fork 5k
fix: opens external anchor using rel=noopener #2728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Any suggestions? cc @NoahDragon |
lib/plugins/helper/link_to.js
Outdated
| if (attrs.external) { | ||
| attrs.target = '_blank'; | ||
| attrs.rel = 'external'; | ||
| attrs.rel = 'noopener'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about external noopener? I'm not sure if noopener already covers the external?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go, I will rework on this PR.
test/scripts/helpers/link_to.js
Outdated
| it('external (boolean)', () => { | ||
| linkTo('http://hexo.io/', 'Hexo', true) | ||
| .should.eql('<a href="http://hexo.io/" title="Hexo" target="_blank" rel="external">Hexo</a>'); | ||
| .should.eql('<a href="http://hexo.io/" title="Hexo" target="_blank" rel="noopener">Hexo</a>'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
|
Sorry, I added review several days ago but forgot to submit them. |
|
LGTM, @NoahDragon I suggest we publish a new patch version with latest hexo-log or bunyan-related dependencies. |
|
@JLHwung Agree. |
see https://developers.google.com/web/tools/lighthouse/audits/noopener
Thank you for creating a pull request to contribute to Hexo code! Before you open the request please review the following guidelines and tips to help it be more easily integrated: