-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-source-drupal): allow specifying disallowed link types #19930
Conversation
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.
Looks good, but I have a question about the use of lodash in 2019
Thanks folks, newcomer here but all that makes sense - thanks for confirming
…On Tue, Dec 3, 2019, 10:13 PM Matt Glaman ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In packages/gatsby-source-drupal/src/gatsby-node.js
<#19930 (comment)>:
> @@ -57,7 +61,7 @@ exports.sourceNodes = async (
})
const allData = await Promise.all(
_.map(data.data.links, async (url, type) => {
- if (type === `self` || type === `describedby`) return
+ if (_.includes(disallowedLinkTypes, type)) return
For what it's worth, I reused lodash here since the file did not know what
node supported. I can update to use the native method. That way new code
slowly move away from lodash
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#19930?email_source=notifications&email_token=AAEHR5XLDECIRI7X4GSQDRTQWZEO3A5CNFSM4JURZ672YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCNX4UGY#discussion_r353143206>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEHR5WSTEDNIEJJD7O7CYLQWZEO3ANCNFSM4JURZ67Q>
.
|
4a70c9d
to
bfb1a5f
Compare
I miss a documentation in the plugin readme |
bfb1a5f
to
8d6b379
Compare
Added information to the README |
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.
Looks good!
The only changes are whitespace related. Can you check whether Prettier ran at all? It's benign but prevents future (unrelated) changes by these files when Prettier does run on them.
Good to merge otherwise!
|
||
You can use the `disallowedLinkTypes` option to skip link types found in JSON:API documents. By default it skips the `self` and `describedby` links, which do not provide data that can be sourced. You may override the setting to add additional link types to be skipped. | ||
|
||
```javascript |
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.
Tip: you can use ```js
here ;) But ```javascript
also works so it's fine either way.
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.
Nevermind previous comments. Turns out we don't format fixtures :)
Thanks!
Description
Adds a
disallowedLinkTypes
setting that allows you to exclude specific link types.By default it excludes
self
anddescribedby
, meeting the current state. This allows skipping link types on/jsonapi
. This way someone could exclude certain resource links from being crawled, so it actually allows someone to add performance enhancements when building.I've added a test fixture and test.
Related Issues
Fixes #19921
Relates #19867
Relates #19879