Skip to content

Commit b0bf3c7

Browse files
committed
Squashed commit of the following:
commit a0f142b [formerly d54c8da] Author: Evan Barger <[email protected]> Date: Wed Mar 3 08:32:27 2021 -0500 Attempt to create latest redirects for legacyREdirects in advo commit fba21d0 [formerly f78ecad] Author: Evan Barger <[email protected]> Date: Wed Mar 3 07:53:08 2021 -0500 Remove test workflow, turn noindex back on for now commit 757a995 [formerly b8b0368] Author: Evan Barger <[email protected]> Date: Tue Mar 2 21:54:15 2021 -0500 Add post-build script that injects /docs path rewriting for netlify at the end commit 3b1097d [formerly 29a878a] Author: Evan Barger <[email protected]> Date: Tue Mar 2 19:54:36 2021 -0500 Switch to different test site, remove meta redirect plugin, remove /docs path rewriting commit 776b9fb [formerly baa3c4d] Author: Evan Barger <[email protected]> Date: Tue Mar 2 18:01:55 2021 -0500 Turn force: true on for legacyRedirects commit 8360239 [formerly a3e01e5] Author: Evan Barger <[email protected]> Date: Tue Mar 2 16:09:45 2021 -0500 Disable noindex header in production commit 2f495fe [formerly 445c01f] Author: Evan Barger <[email protected]> Date: Tue Mar 2 15:33:34 2021 -0500 Clean up add_legacy_redirects a bit, and add a descriptive comment of the state of the script commit c55ede2 [formerly 1e3ef51] Author: Evan Barger <[email protected]> Date: Tue Mar 2 14:50:27 2021 -0500 Create latest redirect for every legact redirect commit 19000af [formerly 1369df3] Merge: 54d0b0c 6fa0915 Author: Evan Barger <[email protected]> Date: Tue Mar 2 13:09:32 2021 -0500 Merge branch 'develop' into feature/evan/legacy-redirects commit 3f29381 [formerly 57dbb3a] Author: Evan Barger <[email protected]> Date: Tue Mar 2 12:16:03 2021 -0500 Add section about redirects to README commit 34fbc95 [formerly 78f6306] Author: Evan Barger <[email protected]> Date: Tue Mar 2 10:07:45 2021 -0500 Remove latest version from redirects_metadata.json commit ed39196 [formerly 6ca4637] Author: Evan Barger <[email protected]> Date: Mon Mar 1 16:33:57 2021 -0500 Remove latest redirects from product_docs commit 54b8795 [formerly 9e8c6aa] Author: Evan Barger <[email protected]> Date: Mon Mar 1 16:33:20 2021 -0500 Change latest redirects to be build by gatsby, instead of by frontmatter script. commit f66fc8c [formerly 9d5d43e] Author: Evan Barger <[email protected]> Date: Mon Mar 1 15:54:31 2021 -0500 Remove pull-sources from test workflow commit ce6ddfc [formerly 15899a8] Merge: 3f432e6 863073c Author: Evan Barger <[email protected]> Date: Mon Mar 1 15:47:11 2021 -0500 Merge branch 'develop' into feature/evan/legacy-redirects commit f6514f1 [formerly 16613e0] Author: Evan Barger <[email protected]> Date: Mon Mar 1 12:52:15 2021 -0500 Fix /docs/ prefix for generated nginx redirects commit 94bb00b [formerly a664d96] Author: Evan Barger <[email protected]> Date: Wed Feb 24 13:02:31 2021 -0500 Add comment within legacyRedirectsGenerated commit 7afd864 [formerly 53724f4] Author: Evan Barger <[email protected]> Date: Wed Feb 24 12:18:01 2021 -0500 Add postgresql language pack redirects, and postgresql installer redirects commit 1445a9f [formerly 43edf0c] Author: Evan Barger <[email protected]> Date: Tue Feb 23 14:24:56 2021 -0500 Create legacy redirects for advocacy commit 2c5fcf0 [formerly a4e8096] Author: Evan Barger <[email protected]> Date: Tue Feb 23 13:49:03 2021 -0500 Add redirect playground file for testing commit 84e73bf [formerly b4fb6b4] Author: Evan Barger <[email protected]> Date: Tue Feb 23 11:59:35 2021 -0500 Generate latest redirects for everything; handle latest redirects different in gatsby-node; manually add redirects for edb_plus and edb_pgadmin_linux_qs commit 83f0440 [formerly 63b8017] Author: Evan Barger <[email protected]> Date: Mon Feb 22 17:49:06 2021 -0500 Move automated redirects into legacyRedirectsGenerated; add manual legacyRedirects to guides that had unmapped urls commit 4d87ddc [formerly 2119bcf] Author: Evan Barger <[email protected]> Date: Mon Feb 22 15:28:33 2021 -0500 Safeguard against stubs that might have redirects commit 90ebfea [formerly 6b82d17] Author: Evan Barger <[email protected]> Date: Mon Feb 22 13:43:28 2021 -0500 First pass of auto-generated legacyRedirects commit b7f5ed5 [formerly 3a154bb] Author: Evan Barger <[email protected]> Date: Mon Feb 22 13:37:37 2021 -0500 Add test workflow commit 0ba10b2 [formerly bbe5407] Author: Evan Barger <[email protected]> Date: Sun Feb 21 14:05:44 2021 -0500 Clean up scrapy scraper and include it in git, comment out some stuff in add_legacy_redirects, add a few notes commit d4dc37f [formerly 75a7c1a] Author: Evan Barger <[email protected]> Date: Sat Feb 20 20:30:51 2021 -0500 Bring over legacy redirects work from eb-old-docs-redirect; create build-legacy-redirects-nginx script Former-commit-id: 8d6bfaf
1 parent 3f2b869 commit b0bf3c7

File tree

1,423 files changed

+23822
-625
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,423 files changed

+23822
-625
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,6 @@ product_docs/content/*
7979
!product_docs/content/.keep
8080
product_docs/content_build/*
8181
!product_docs/content_build/.keep
82+
static/nginx_redirects.generated
8283
temp_kubernetes/build/*
8384

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,36 @@ Production is hosted on Netlify, and is built from the `main` branch. The build
115115

116116
Review builds are automatically created for pull requests. These builds are created by Heroku, and only include advocacy content, no other sources.
117117

118+
## Redirects
119+
120+
The app is concerned with two different types of redirects that can be defined in frontmatter.
121+
122+
### Internal Redirects (within Docs 2.0)
123+
124+
#### `redirects`
125+
126+
The `redirects` frontmatter is to be used for redirects internal to Docs. For example, if you had a file `great_file.mdx` with this following frontmatter...
127+
128+
```yaml
129+
redirects:
130+
- '/old_path'
131+
- '/another_old_path'
132+
```
133+
134+
both `/old_path` and `/another_old_path` would redirect to `great_file.mdx`'s current path. This is perfect for setting up redirects when moving a file around within Docs. Redirects created with `redirects` are permanent (301).
135+
136+
### Docs 1.0 to Docs 2.0 redirects
137+
138+
This app builds a list of nginx style redirects that are loaded into a separate server. These redirects direct users from links to the old docs site, to the appropriate page on the new docs site.
139+
140+
#### `legacyRedirectsGenerated`
141+
142+
This frontmatter is an automatically generated list of redirects for Docs 1.0 to Docs 2.0 (this repo). These redirects are built by `scripts/legacy_redirects/add_legecy_redirects.py`, and **should not be manually edited**.
143+
144+
#### `legacyRedirects`
145+
146+
If you need to setup a redirect from Docs 1.0 to Docs 2.0 manually, this is the place to do it. If the `legacyRedirectsGenerated` frontmatter does not include the redirect you need, you should add it here.
147+
118148
# Advocacy Docs (left over from previous README, needs attention)
119149

120150
Advocacy doc files are in [advocacy_docs/getting-started](https://github.com/EnterpriseDB/docs/tree/master/advocacy_docs/getting-started)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: 'Redirects'
3+
redirects:
4+
- '/redirect-demo'
5+
6+
legacyRedirects:
7+
- '/edb-docs/redirect-demo'
8+
---

advocacy_docs/supported-open-source/postgresql/installer/01_requirements_overview.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Requirements Overview"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/requirements_overview.html"
46
---
57

68

advocacy_docs/supported-open-source/postgresql/installer/02_installing_postgresql_with_the_graphical_installation_wizard/01_invoking_the_graphical_installer.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Invoking the Graphical Installer"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/invoking_the_graphical_installer.html"
46
---
57

68

advocacy_docs/supported-open-source/postgresql/installer/02_installing_postgresql_with_the_graphical_installation_wizard/index.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Installing PostgreSQL with the Graphical Installation Wizard"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/installing_postgresql_with_the_graphical_installation_wizard.html"
46
---
57

68

advocacy_docs/supported-open-source/postgresql/installer/03_using_stackbuilder.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Using Stack Builder"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/using_stackbuilder.html"
46
---
57

68
<div id="using_stackbuilder" class="registered_link"></div>

advocacy_docs/supported-open-source/postgresql/installer/04_installation_troubleshooting.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Installation Troubleshooting"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/installation_troubleshooting.html"
46
---
57

68

advocacy_docs/supported-open-source/postgresql/installer/05_uninstalling_postgresql.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Uninstalling PostgreSQL"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/uninstalling_postgresql.html"
46
---
57

68

gatsby-config.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const ANSI_BLUE = '\033[34m';
88
const ANSI_STOP = '\033[0m';
99

1010
const isBuild = process.env.NODE_ENV === 'production';
11+
const isProduction = process.env.APP_ENV === 'production';
1112
const algoliaIndex = process.env.ALGOLIA_INDEX_NAME || 'edb-staging';
1213

1314
/******** Sourcing *********/
@@ -282,6 +283,14 @@ const splitNodeContent = (nodes) => {
282283
return result;
283284
};
284285

286+
const netlifyHeaders = () => {
287+
// if (isProduction) return {};
288+
289+
return {
290+
'/*': ['X-Robots-Tag: noindex'],
291+
};
292+
};
293+
285294
/********** Gatsby config *********/
286295
module.exports = {
287296
flags: {
@@ -305,13 +314,10 @@ module.exports = {
305314
'gatsby-transformer-json',
306315
'gatsby-plugin-catch-links',
307316
'gatsby-plugin-sharp',
308-
'gatsby-plugin-meta-redirect',
309317
{
310318
resolve: 'gatsby-plugin-netlify',
311319
options: {
312-
headers: {
313-
'/*': ['X-Robots-Tag: noindex'],
314-
},
320+
headers: netlifyHeaders(),
315321
},
316322
},
317323
// 'gatsby-plugin-remove-fingerprints', // speeds up Netlify, see https://github.com/narative/gatsby-plugin-remove-fingerprints
@@ -416,6 +422,14 @@ module.exports = {
416422
id: process.env.GTM_ID,
417423
},
418424
},
425+
{
426+
resolve: 'gatsby-plugin-nginx-redirect',
427+
options: {
428+
inputConfigFile: `${__dirname}/static/nginx_redirects.template`,
429+
outputConfigFile: `${__dirname}/static/nginx_redirects.generated`,
430+
whereToIncludeRedirects: '', // defaults to: "server"
431+
},
432+
},
419433
],
420434
};
421435

gatsby-node.js

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const {
2121
treeToNavigation,
2222
treeNodeToNavNode,
2323
findPrevNextNavNodes,
24+
configureRedirects,
25+
configureLegacyRedirects,
2426
} = require('./src/constants/gatsby-node-utils.js');
2527

2628
const isBuild = process.env.NODE_ENV === 'production';
@@ -83,6 +85,9 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
8385
productStub
8486
indexCards
8587
navigation
88+
legacyRedirects
89+
legacyRedirectsGenerated
90+
navigation
8691
katacodaPages {
8792
scenario
8893
account
@@ -183,17 +188,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
183188
// set computed frontmatter
184189
node.frontmatter = computeFrontmatterForTreeNode(curr);
185190

186-
// set up frontmatter redirects
187-
if (node.frontmatter.redirects) {
188-
node.frontmatter.redirects.forEach((fromPath) => {
189-
actions.createRedirect({
190-
fromPath,
191-
toPath: node.fields.path,
192-
redirectInBrowser: true,
193-
isPermanent: true,
194-
});
195-
});
196-
}
191+
configureRedirects(node.fields.path, node.frontmatter.redirects, actions);
197192

198193
// build navigation tree
199194
const navigationDepth = 2;
@@ -226,6 +221,18 @@ const createDoc = (navTree, prevNext, doc, productVersions, actions) => {
226221
});
227222
}
228223

224+
// configure legacy redirects
225+
if (!doc.frontmatter.productStub) {
226+
configureLegacyRedirects({
227+
toPath: doc.fields.path,
228+
toLatestPath: replacePathVersion(doc.fields.path),
229+
redirects: (doc.frontmatter.legacyRedirects || []).concat(
230+
doc.frontmatter.legacyRedirectsGenerated || [],
231+
),
232+
actions,
233+
});
234+
}
235+
229236
const isIndexPage = isPathAnIndexPage(doc.fileAbsolutePath);
230237
const docsRepoUrl = 'https://github.com/EnterpriseDB/docs';
231238
const branch = isProduction ? 'main' : 'develop';
@@ -264,6 +271,16 @@ const createDoc = (navTree, prevNext, doc, productVersions, actions) => {
264271
};
265272

266273
const createAdvocacy = (navTree, prevNext, doc, learn, actions) => {
274+
// configure legacy redirects
275+
configureLegacyRedirects({
276+
toPath: doc.fields.path,
277+
toLatestPath: doc.fields.path,
278+
redirects: (doc.frontmatter.legacyRedirects || []).concat(
279+
doc.frontmatter.legacyRedirectsGenerated || [],
280+
),
281+
actions,
282+
});
283+
267284
const navLinks = learn.filter(
268285
(node) => node.fields.topic === doc.fields.topic,
269286
);
@@ -399,6 +416,8 @@ exports.createSchemaCustomization = ({ actions }) => {
399416
type Frontmatter {
400417
originalFilePath: String
401418
indexCards: TileModes
419+
legacyRedirects: [String]
420+
legacyRedirectsGenerated: [String]
402421
}
403422
404423
enum TileModes {

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
"develop": "gatsby develop",
1313
"config-sources": "python3 scripts/source/config_sources.py",
1414
"format": "prettier --write src/**/*.js gatsby-*.js",
15-
"build": "gatsby build --prefix-paths",
15+
"build": "gatsby build --prefix-paths && bash scripts/post-build.sh",
1616
"serve-build": "gatsby serve --prefix-paths",
1717
"update-icons": "git submodule update --init --remote && node scripts/createIconTypes.js && node scripts/createIconNames.js",
1818
"build-pdf": "python3 scripts/pdf/generate_pdf.py",
1919
"build-all-pdfs": "for i in product_docs/docs/**/*/ ; do echo \"$i\"; python3 scripts/pdf/generate_pdf.py ${i%}; done",
2020
"fix-mtimes": "python3 scripts/source/git-restore-mtime.py",
2121
"count": "find product_docs/docs/ advocacy_docs/ external_sources/ -name '*.mdx' | wc -l",
22-
"heroku-postbuild": "gatsby build"
22+
"heroku-postbuild": "gatsby build",
23+
"build-legacy-redirects-nginx": "gatsby clean && gatsby build --prefix-paths && python3 scripts/legacy_redirects/clean_up_output.py"
2324
},
2425
"husky": {
2526
"hooks": {
@@ -44,6 +45,7 @@
4445
"gatsby-plugin-mdx": "^1.2.6",
4546
"gatsby-plugin-meta-redirect": "^1.1.1",
4647
"gatsby-plugin-netlify": "^2.3.13",
48+
"gatsby-plugin-nginx-redirect": "^0.0.11",
4749
"gatsby-plugin-react-helmet": "^3.3.1",
4850
"gatsby-plugin-react-svg": "^3.0.0",
4951
"gatsby-plugin-remove-fingerprints": "^0.0.2",

product_docs/README.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

product_docs/docs/ark/3.5/ark_admin/01_ark_whats_new.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "What's New"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_whats_new.html"
37
---
48

59
<div id="ark_whats_new" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/02_ark_supported_platforms.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Supported Platforms"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_supported_platforms.html"
37
---
48

59
<div id="ark_supported_platforms" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/03_ark_architecture_overview.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Ark Architecture Overview"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_architecture_overview.html"
37
---
48

59
<div id="ark_architecture_overview" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/04_ark_registering_with_pem.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Registering an Ark Cluster with PEM"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_registering_with_pem.html"
37
---
48

59
<div id="ark_registering_with_pem" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/05_ark_authentication_models.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Ark Authentication Models"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_authentication_models.html"
37
---
48

59
<div id="ark_authentication_models" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/06_ark_installing_console/01_ark_installing_console_aws.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Installing the Ark Console on AWS"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_installing_console_aws.html"
37
---
48

59
<div id="ark_installing_console_aws" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/06_ark_installing_console/02_ark_installing_console_azure.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Installing the Ark Console on Azure"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_installing_console_azure.html"
37
---
48

59
<div id="ark_installing_console_azure" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/06_ark_installing_console/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Installing the Ark Console"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_installing_console.html"
37
---
48

59
<div id="ark_installing_console" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/07_ark_admin_features.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Administrative Features of the EDB Ark Console"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_admin_features.html"
37
---
48

59
<div id="ark_admin_features" class="registered_link"></div>

0 commit comments

Comments
 (0)