-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
support wildcard domain #33
Conversation
Signed-off-by: Thomas Tang <[email protected]>
Signed-off-by: Thomas Tang <[email protected]>
Signed-off-by: Thomas Tang <[email protected]>
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.
It won't pass unit tests. And You need to add test cases
- **exclude** - Exclude hostname. Specify subdomain when applicable, including `www`. | ||
- 'exclude1.com' does not apply to `www.exclude1.com` nor `en.exclude1.com`. | ||
- **exclude** - Exclude hostname. Subdomain also supported well, such as `www` or `app`. | ||
- 'exclude1.com' now apply to `www.exclude1.com` and `en.exclude1.com` in this [commit](https://github.com/tangkunyin/hexo-filter-nofollow/commit/cf05a07054536dfaa36f986493e678252f31ad45) |
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.
- 'exclude1.com' now apply to `www.exclude1.com` and `en.exclude1.com` in this [commit](https://github.com/tangkunyin/hexo-filter-nofollow/commit/cf05a07054536dfaa36f986493e678252f31ad45) | |
- 'exclude1.com' apply to `www.exclude1.com` and `en.exclude1.com`. |
@@ -12,11 +12,11 @@ function isExternal(url, config) { | |||
|
|||
if (exclude && exclude.length) { | |||
for (const i of exclude) { | |||
if (host === i) return false; | |||
if (i === host || (host && host.endsWith(i))) return false; |
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.
unnecessary repetition
} | ||
} | ||
|
||
if (host !== sitehost) return true; | ||
if (sitehost !== host && (host && !host.endsWith(sitehost))) return true; |
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.
For host to be null, it is recommended to use early return
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "hexo-filter-nofollow", | |||
"version": "2.0.2", | |||
"version": "2.0.3", |
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.
No need to modify it
#12 Some users may want a more precise match, and using wildcards by default may not be a good idea. |
Ok, got it. Then I will close this PR. |
check list
Description
Support wildcard domain, that means subdomain also supported well, such as
www
oren
.Now we can just configure only
exclude.com
and it will be worked on*.exclude.com
Additional information
No!