generated from colbyfayock/next-wordpress-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
next.config.js
42 lines (33 loc) · 1.62 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const withPlugins = require('next-compose-plugins');
const indexSearch = require('./plugins/search-index');
const feed = require('./plugins/feed');
const sitemap = require('./plugins/sitemap');
const socialImages = require('./plugins/socialImages');
module.exports = withPlugins([[indexSearch], [feed], [sitemap], [socialImages]], {
// By default, Next.js removes the trailing slash. One reason this would be good
// to include is by default, the `path` property of the router for the homepage
// is `/` and by using that, would instantly create a redirect
trailingSlash: true,
// By enabling verbose logging, it will provide additional output details for
// diagnostic purposes. By default is set to false.
// verbose: true,
env: {
WORDPRESS_GRAPHQL_ENDPOINT: process.env.WORDPRESS_GRAPHQL_ENDPOINT,
WORDPRESS_MENU_LOCATION_NAVIGATION: process.env.WORDPRESS_MENU_LOCATION_NAVIGATION || 'PRIMARY',
WORDPRESS_PLUGIN_SEO: parseEnvValue(process.env.WORDPRESS_PLUGIN_SEO, false),
// The image directory for open graph images will be saved at the location above
// with `public` prepended. By default, images will be saved at /public/images/og
// and available at /images/og. If changing, make sure to update the .gitignore
OG_IMAGE_DIRECTORY: '/images/og',
},
});
/**
* parseEnv
* @description Helper function to check if a variable is defined and parse booelans
*/
function parseEnvValue(value, defaultValue) {
if (typeof value === 'undefined') return defaultValue;
if (value === true || value === 'true') return true;
if (value === false || value === 'false') return false;
return value;
}