· 6 years ago · Nov 13, 2019, 02:50 PM
1// In your gatsby-config.js
2module.exports = {
3 plugins: [
4 /*
5 * Gatsby's data processing layer begins with “source”
6 * plugins. Here the site sources its data from WordPress.
7 */
8 {
9 resolve: "gatsby-source-wordpress",
10 options: {
11 /*
12 * The base URL of the WordPress site without the trailingslash and the protocol. This is required.
13 * Example : 'gatsbyjsexamplewordpress.wordpress.com' or 'www.example-site.com'
14 */
15 baseUrl: "localhost/thirdhome-wp",
16 // The protocol. This can be http or https.
17 protocol: "http",
18 // Indicates whether the site is hosted on wordpress.com.
19 // If false, then the assumption is made that the site is self hosted.
20 // If true, then the plugin will source its content on wordpress.com using the JSON REST API V2.
21 // If your site is hosted on wordpress.org, then set this to false.
22 hostingWPCOM: false,
23 // If useACF is true, then the source plugin will try to import the WordPress ACF Plugin contents.
24 // This feature is untested for sites hosted on wordpress.com.
25 // Defaults to true.
26 useACF: true,
27 // Include specific ACF Option Pages that have a set post ID
28 // Regardless if an ID is set, the default options route will still be retrieved
29 // Must be using V3 of ACF to REST to include these routes
30 // Example: `["option_page_1", "option_page_2"]` will include the proper ACF option
31 // routes with the ID option_page_1 and option_page_2
32 // The IDs provided to this array should correspond to the `post_id` value when defining your
33 // options page using the provided `acf_add_options_page` method, in your WordPress setup
34 // Dashes in IDs will be converted to underscores for use in GraphQL
35 acfOptionPageIds: [],
36 auth: {
37 // If auth.user and auth.pass are filled, then the source plugin will be allowed
38 // to access endpoints that are protected with .htaccess.
39 // htaccess_user: "your-htaccess-username",
40 // htaccess_pass: "your-htaccess-password",
41 // htaccess_sendImmediately: false,
42
43 // If hostingWPCOM is true then you will need to communicate with wordpress.com API
44 // in order to do that you need to create an app (of type Web) at https://developer.wordpress.com/apps/
45 // then add your clientId, clientSecret, username, and password here
46 // Learn about environment variables: https://www.gatsbyjs.org/docs/environment-variables
47 // If two-factor authentication is enabled then you need to create an Application-Specific Password,
48 // see https://en.support.wordpress.com/security/two-step-authentication/#application-specific-passwords
49 // wpcom_app_clientSecret: process.env.WORDPRESS_CLIENT_SECRET,
50 // wpcom_app_clientId: "54793",
51 wpcom_user: "thirdhome_wp",
52 wpcom_pass: "thirdhome_wp"
53
54 // If you use "JWT Authentication for WP REST API" (https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/)
55 // or (https://github.com/jonathan-dejong/simple-jwt-authentication) requires jwt_base_path, path can be found in WordPress wp-api.
56 // plugin, you can specify user and password to obtain access token and use authenticated requests against WordPress REST API.
57 // jwt_user: process.env.JWT_USER,
58 // jwt_pass: process.env.JWT_PASSWORD,
59 // jwt_base_path: "/jwt-auth/v1/token" // Default - can skip if you are using https://wordpress.org/plugins/jwt-authentication-for-wp-rest-api/
60 },
61 // Set cookies that should be send with requests to WordPress as key value pairs
62 cookies: {},
63 // Set verboseOutput to true to display a verbose output on `npm run develop` or `npm run build`
64 // It can help you debug specific API Endpoints problems.
65 verboseOutput: false,
66 // Set how many pages are retrieved per API request.
67 perPage: 100,
68 // Search and Replace Urls across WordPress content.
69 searchAndReplaceContentUrls: {
70 sourceUrl: "https://source-url.com",
71 replacementUrl: "https://replacement-url.com"
72 },
73 // Set how many simultaneous requests are sent at once.
74 concurrentRequests: 10,
75 // Set WP REST API routes whitelists
76 // and blacklists using glob patterns.
77 // Defaults to whitelist the routes shown
78 // in the example below.
79 // See: https://github.com/isaacs/minimatch
80 // Example: `["/*/*/comments", "/yoast/**"]`
81 // ` will either include or exclude routes ending in `comments` and
82 // all routes that begin with `yoast` from fetch.
83 // Whitelisted routes using glob patterns
84 includedRoutes: [
85 "**/categories",
86 "**/posts",
87 "**/pages",
88 "**/media",
89 "**/tags",
90 "**/taxonomies",
91 "**/users"
92 ],
93 // Blacklisted routes using glob patterns
94 excludedRoutes: ["**/posts/1456"],
95 // Set this to keep media sizes.
96 // This option is particularly useful in case you need access to
97 // URLs for thumbnails, or any other media detail.
98 // Defaults to false
99 keepMediaSizes: false,
100 // use a custom normalizer which is applied after the built-in ones.
101 normalizer: function({ entities }) {
102 return entities
103 }
104 }
105 }
106 ]
107}