Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 50287b3

Browse files
committed
fixes for docs site
1 parent 616b501 commit 50287b3

23 files changed

+280
-109
lines changed

config.js

Lines changed: 5 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,18 @@
11
const config = {
22
gatsby: {
33
pathPrefix: '/',
4-
siteUrl: 'https://hasura.io',
5-
gaTrackingId: null,
4+
siteUrl: 'https://docs.neuralmagic.com',
5+
gaTrackingId: "G-L2QW513YN1",
66
trailingSlash: false,
77
},
8-
header: {
9-
logo: 'https://graphql-engine-cdn.hasura.io/learn-hasura/assets/homepage/brand.svg',
10-
logoLink: 'https://hasura.io/learn/',
11-
title:
12-
"<a href='https://hasura.io/learn/'><img class='img-responsive' src='https://graphql-engine-cdn.hasura.io/learn-hasura/assets/homepage/learn-logo.svg' alt='Learn logo' /></a>",
13-
githubUrl: 'https://github.com/hasura/gatsby-gitbook-boilerplate',
14-
helpUrl: '',
15-
tweetText: '',
16-
social: `<li>
17-
<a href="https://twitter.com/hasurahq" target="_blank" rel="noopener">
18-
<div class="twitterBtn">
19-
<img src='https://graphql-engine-cdn.hasura.io/learn-hasura/assets/homepage/twitter-brands-block.svg' alt={'Twitter'}/>
20-
</div>
21-
</a>
22-
</li>
23-
<li>
24-
<a href="https://discordapp.com/invite/hasura" target="_blank" rel="noopener">
25-
<div class="discordBtn">
26-
<img src='https://graphql-engine-cdn.hasura.io/learn-hasura/assets/homepage/discord-brands-block.svg' alt={'Discord'}/>
27-
</div>
28-
</a>
29-
</li>`,
30-
links: [{ text: '', link: '' }],
31-
search: {
32-
enabled: false,
33-
indexName: '',
34-
algoliaAppId: process.env.GATSBY_ALGOLIA_APP_ID,
35-
algoliaSearchKey: process.env.GATSBY_ALGOLIA_SEARCH_KEY,
36-
algoliaAdminKey: process.env.ALGOLIA_ADMIN_KEY,
37-
},
38-
},
39-
sidebar: {
40-
forcedNavOrder: [
41-
'/introduction', // add trailing slash if enabled above
42-
'/codeblock',
43-
],
44-
collapsedNav: [
45-
'/codeblock', // add trailing slash if enabled above
46-
],
47-
links: [{ text: 'Hasura', link: 'https://hasura.io' }],
48-
frontLine: false,
49-
ignoreIndex: true,
50-
title:
51-
"<a href='https://hasura.io/learn/'>graphql </a><div class='greenCircle'></div><a href='https://hasura.io/learn/graphql/react/introduction/'>react</a>",
52-
},
538
siteMetadata: {
54-
title: 'Gatsby Gitbook Boilerplate | Hasura',
55-
description: 'Documentation built with mdx. Powering hasura.io/learn ',
56-
ogImage: null,
57-
docsLocation: 'https://github.com/hasura/gatsby-gitbook-boilerplate/tree/master/content',
58-
favicon: 'https://graphql-engine-cdn.hasura.io/img/hasura_icon_black.svg',
9+
docsLocation: 'https://docs.neuralmagic.com',
5910
},
6011
pwa: {
6112
enabled: false, // disabling this will also remove the existing service worker.
6213
manifest: {
63-
name: 'Gatsby Gitbook Starter',
64-
short_name: 'GitbookStarter',
14+
name: 'Neural Magic Docs',
15+
short_name: 'Neural Magic Docs',
6516
start_url: '/',
6617
background_color: '#6b37bf',
6718
theme_color: '#6b37bf',

gatsby-browser.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
export const onServiceWorkerUpdateReady = () => {
22
const answer = window.confirm(
3-
`This tutorial has been updated. ` +
4-
`Reload to display the latest version?`
3+
`This webpage has been updated. Reload to display the latest version?`
54
)
65
if (answer === true) {
76
window.location.reload()
87
}
9-
}
8+
}

gatsby-config.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ const plugins = [
3737
}
3838
},
3939
{
40-
resolve: `gatsby-plugin-gtag`,
40+
resolve: `gatsby-plugin-google-gtag`,
4141
options: {
42-
trackingId: config.gatsby.gaTrackingId,
43-
head: true,
44-
anonymize: false,
42+
trackingIds: [
43+
"G-L2QW513YN1", // Google Analytics / GA
44+
],
45+
pluginConfig: {
46+
// Puts tracking script in the head instead of the body
47+
head: true
48+
},
4549
},
4650
},
4751
'gatsby-plugin-remove-serviceworker',
@@ -54,6 +58,7 @@ const plugins = [
5458
}
5559
}
5660
},
61+
`gatsby-plugin-meta-redirect`, // keep it in last in list
5762
];
5863

5964
module.exports = {
@@ -64,12 +69,7 @@ module.exports = {
6469
docsLocation: config.siteMetadata.docsLocation,
6570
ogImage: config.siteMetadata.ogImage,
6671
favicon: config.siteMetadata.favicon,
67-
logo: { link: config.header.logoLink ? config.header.logoLink : '/', image: config.header.logo }, // backwards compatible
68-
headerTitle: config.header.title,
69-
githubUrl: config.header.githubUrl,
70-
helpUrl: config.header.helpUrl,
71-
tweetText: config.header.tweetText,
72-
headerLinks: config.header.links,
72+
logo: { link: config.siteMetadata.logo }, // backwards compatible
7373
siteUrl: config.gatsby.siteUrl,
7474
},
7575
plugins: plugins,

gatsby-node.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const path = require('path');
33
const startCase = require('lodash.startcase');
44

55
exports.createPages = ({ graphql, actions }) => {
6-
const { createPage } = actions;
6+
const { createPage, createRedirect } = actions;
77

88
return new Promise((resolve, reject) => {
99
resolve(
@@ -42,6 +42,12 @@ exports.createPages = ({ graphql, actions }) => {
4242
},
4343
});
4444
});
45+
46+
// create redirect pages
47+
createRedirect({ fromPath: '/deepsparse', toPath: '/products/deepsparse', redirectInBrowser: true, isPermanent: true });
48+
createRedirect({ fromPath: '/sparseml', toPath: '/products/sparseml', redirectInBrowser: true, isPermanent: true });
49+
createRedirect({ fromPath: '/sparsezoo', toPath: '/products/sparsezoo', redirectInBrowser: true, isPermanent: true });
50+
createRedirect({ fromPath: '/sparsify', toPath: '/archive/sparsify', isPermanent: true });
4551
})
4652
);
4753
});
@@ -103,3 +109,9 @@ exports.onCreateNode = ({ node, getNode, actions }) => {
103109
});
104110
}
105111
};
112+
113+
exports.onPostBuild = ({ store }) => {
114+
const { redirects } = store.getState();
115+
116+
console.log(redirects);
117+
}

0 commit comments

Comments
 (0)