Skip to content

Commit

Permalink
Implement "gatsby-plugin-netlify" configuration
Browse files Browse the repository at this point in the history
Integrated gatsby-plugin-netlify like documented in the "Hosting &
Continuous Deployment"”" design concept. It allows to automatically
generate a `_headers` file and a `_redirects` file at the root of the
public folder to configure HTTP headers (3) and redirects (4) on
Netlify.

One of the main advantages is that it also enables HTTP/2 server push of
critical Gatsby assets through the `Link` headers. By default, the
plugin adds HTTP/2 assets to server push the critical Gatsby scripts
(ones that have the `preload` attribute already) and also adds some
basic security and caching headers.

References:
  (1) https://www.npmjs.com/package/gatsby-plugin-netlify
  (2) #46
  (3) https://www.netlify.com/docs/headers-and-basic-auth
  (4) https://www.netlify.com/docs/redirects

Associated epic: GH-46
GH-89
  • Loading branch information
arcticicestudio committed Dec 19, 2018
1 parent 9c45022 commit 1da3ec3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,16 @@ module.exports = {
options: {
/* The tracking IDs for all used "Google Marketing" products. */
trackingIds: [GOOGLE_UNIVERSAL_ANALYTICS_TRACKING_ID],

/* The configuration that gets passed to the `gtag.js`'s `config` command. */
/* eslint-disable-next-line babel/camelcase */
gtagConfig: { anonymize_ip: true },

pluginConfig: {
/*
* Put the `gtag.js` tracking script in the HTML `<head>` instead of the `<body>` as recommended by Google.
*
* @see https://developers.google.com/analytics/devguides/collection/gtagjs
*/
head: true,

/*
* Respect the 'Do Not Track' HTTP header.
*
Expand All @@ -106,6 +103,8 @@ module.exports = {
respectDNT: true
}
}
}
},
/* NOTE: The following plugins must be listed last in this array to work properly! */
"gatsby-plugin-netlify"
]
};

0 comments on commit 1da3ec3

Please sign in to comment.