Skip to content

Commit

Permalink
Merge pull request #93 from arcticicestudio/feature/gh-91-gatsby-plug…
Browse files Browse the repository at this point in the history
…in-offline

Gatsby Plugin "Web App Manifest"
  • Loading branch information
arcticicestudio authored Dec 19, 2018
2 parents b4a91fd + d4fec8a commit 6415ddc
Show file tree
Hide file tree
Showing 6 changed files with 431 additions and 29 deletions.
40 changes: 40 additions & 0 deletions .gatsby/plugins/google/gtag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <development@arcticicestudio.com>
* Copyright (C) 2018-present Sven Greb <development@svengreb.de>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file The configuration for the Gatsby plugin `gatsby-plugin-google-gtag`.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @see https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-google-gtag
* @since 0.4.0
*/

const { GOOGLE_UNIVERSAL_ANALYTICS_TRACKING_ID } = require("../../../src/config/internal/constants");

module.exports = {
/* 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.
*
* @see https://en.wikipedia.org/wiki/Do_Not_Track
*/
respectDNT: true
}
};
41 changes: 41 additions & 0 deletions .gatsby/plugins/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (C) 2018-present Arctic Ice Studio <development@arcticicestudio.com>
* Copyright (C) 2018-present Sven Greb <development@svengreb.de>
*
* Project: Nord Docs
* Repository: https://github.com/arcticicestudio/nord-docs
* License: MIT
*/

/**
* @file The configuration for the Gatsby plugin `gatsby-plugin-manifest`.
* @author Arctic Ice Studio <development@arcticicestudio.com>
* @author Sven Greb <development@svengreb.de>
* @see https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-manifest
* @since 0.4.0
*/

/* eslint-disable babel/camelcase */

const { metadataNord } = require("../../src/data/project");
const { ROUTE_ROOT } = require("../../src/config/routes/mappings");

module.exports = {
name: metadataNord.name,
short_name: metadataNord.name,
start_url: ROUTE_ROOT,
background_color: "#d8dee9",
theme_color: "#88c0d0",
/*
* Enables the "Add to Homescreen" prompt and disables browser UI (including back button)
* @see https://developers.google.com/web/fundamentals/web-app-manifest/#display
*/
display: "standalone",
/* The relative path (starting from the project root) to the source icon all other favicons will be generated from. */
icon: "src/assets/images/icons/favicon.svg",
/*
* Enable support for legacy `apple-touch-icon` links. Support for the web app manifest specification was added first
* in iOS 11.3.
*/
legacy: true
};
34 changes: 9 additions & 25 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ const {
BASE_DIR_CONTENT,
BASE_DIR_ASSETS_IMAGES,
BASE_DIR_CONFIG,
BASE_DIR_PAGES,
GOOGLE_UNIVERSAL_ANALYTICS_TRACKING_ID
BASE_DIR_PAGES
} = require("./src/config/internal/constants");
const { BASE_PUBLIC_URL } = require("./src/config/routes/constants");
const gatsbyPluginGoogleGtagConfig = require("./.gatsby/plugins/google/gtag");
const gatsbyPluginManifestConfig = require("./.gatsby/plugins/manifest");

module.exports = {
siteMetadata: {
Expand Down Expand Up @@ -82,29 +83,12 @@ module.exports = {
},
{
resolve: "gatsby-plugin-google-gtag",
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.
*
* @see https://en.wikipedia.org/wiki/Do_Not_Track
*/
respectDNT: true
}
}
options: gatsbyPluginGoogleGtagConfig
},
/* NOTE: The following plugins must be listed last in this array to work properly! */
"gatsby-plugin-netlify"
/* NOTE: The following plugins rely on the order in this array and must be placed at last in order work properly! */
{
resolve: "gatsby-plugin-manifest",
options: gatsbyPluginManifestConfig
}
]
};
Loading

0 comments on commit 6415ddc

Please sign in to comment.