Link fixes via aliases and the webserver (#3667)

* fixed broken links, updated edge.js, closes #3642

* updated edge.js with fixed redirects

* removed duplicate alias
pull/3668/head
Scott Anderson 2022-01-12 12:56:54 -07:00 committed by GitHub
parent 5fb76b21eb
commit faec62f637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 1 deletions

View File

@ -106,7 +106,7 @@ join(
### Sort by tags
InfluxQL's sorting capabilities are very limited, allowing you only to control the
sort order of `time` using the `ORDER BY time` clause.
Flux's [`sort()` function](/{{< latest "flux" >}}/stdlib/universer/sort) sorts records based on list of columns.
Flux's [`sort()` function](/{{< latest "flux" >}}/stdlib/universe/sort) sorts records based on list of columns.
Depending on the column type, records are sorted lexicographically, numerically, or chronologically.
```js

View File

@ -9,6 +9,7 @@ menu:
weight: 1
aliases:
- /influxdb/v2.0/reference/flux/
- /influxdb/v2.1/reference/flux/
- /influxdb/cloud/reference/flux/
---

View File

@ -10,6 +10,7 @@ weight: 2
aliases:
- /influxdb/v2.0/reference/flux/language/
- /influxdb/cloud/reference/flux/language/
- /flux/v0.x/language/
flux/v0.x/tags: [flux]
---

View File

@ -6,7 +6,11 @@ description: >
aliases:
- /influxdb/v2.0/reference/flux/functions/
- /influxdb/v2.0/reference/flux/stdlib/
- /influxdb/v2.1/reference/flux/functions/
- /influxdb/v2.1/reference/flux/stdlib/
- /influxdb/cloud/reference/flux/stdlib/
- /influxdb/cloud/reference/flux/stdlib/
- /flux/v0.x/functions/
flux/v0.x/tags: [flux, functions, package]
menu:
flux_0_x_ref:

View File

@ -9,6 +9,7 @@ aliases:
- /influxdb/cloud/reference/flux/stdlib/experimental/array/
- /influxdb/v2.0/reference/flux/stdlib/array/
- /influxdb/cloud/reference/flux/stdlib/array/
- /flux/v0.x/stdlib/experimental/array/
menu:
flux_0_x_ref:
name: array

View File

@ -7,6 +7,7 @@ aliases:
- /influxdb/cloud/reference/flux/stdlib/array/from/
- /influxdb/v2.0/reference/flux/stdlib/experimental/array/from/
- /influxdb/cloud/reference/flux/stdlib/experimental/array/from/
- /flux/v0.x/stdlib/experimental/array/from/
menu:
flux_0_x_ref:
name: array.from

View File

@ -97,6 +97,9 @@ exports.handler = (event, context, callback) => {
//////////////////////////// v2 subdomain redirect ///////////////////////////
permanentRedirect(request.headers.host[0].value === 'v2.docs.influxdata.com', `https://docs.influxdata.com${request.uri}`);
///////////////////////// Force v in version numbers /////////////////////////
permanentRedirect(/(^\/[\w]*\/)(\d\.)/.test(request.uri), request.uri.replace(/(^\/[\w]*\/)(\d\.)/, `$1v$2`));
////////////////////////// Latest version redirects //////////////////////////
temporaryRedirect(/\/influxdb\/latest/.test(request.uri), request.uri.replace(/\/latest/, `/${latestVersions['influxdb']}`));
temporaryRedirect(/\/telegraf\/latest/.test(request.uri), request.uri.replace(/\/latest/, `/${latestVersions['telegraf']}`));
@ -130,6 +133,15 @@ exports.handler = (event, context, callback) => {
temporaryRedirect(/\/influxdb\/(?:v2\.[0-9]{1,2}|cloud)\/reference\/flux\/stdlib\/built-in\/transformations\/$/.test(request.uri), `/flux/${latestVersions['flux']}/function-types/`);
temporaryRedirect(/\/influxdb\/(v2\.[0-9]{1,2}|cloud)\/reference\/flux\/stdlib\/built-in\/$/.test(request.uri), `/flux/${latestVersions['flux']}/stdlib/universe/`);
temporaryRedirect(/\/flux\/v0\.x\/stdlib\/built-in\/(?:inputs\/|outputs\/|misc\/|tests\/)(\w+\/$)/.test(request.uri), request.uri.replace(/\/flux\/v0\.x\/stdlib\/built-in\/(?:inputs\/|outputs\/|misc\/|tests\/)(\w+\/$)/, `/flux/${latestVersions['flux']}/stdlib/universe/$1`));
temporaryRedirect(/\/flux\/v0\.x\/stdlib\/built-in\/(?:inputs\/|outputs\/|misc\/|tests\/)$/.test(request.uri), `/flux/${latestVersions['flux']}/function-types/`);
temporaryRedirect(/\/flux\/v0\.x\/stdlib\/built-in\/transformations\/(?:aggregates\/|selectors\/|stream-table\/|type-conversions\/)(\w+\/$)/.test(request.uri), request.uri.replace(/\/flux\/v0\.x\/stdlib\/built-in\/transformations\/(?:aggregates\/|selectors\/|stream-table\/|type-conversions\/)(\w+\/$)/, `/flux/${latestVersions['flux']}/stdlib/universe/$1`));
temporaryRedirect(/\/flux\/v0\.x\/stdlib\/built-in\/transformations\/(?:aggregates\/|selectors\/|stream-table\/|type-conversions\/)/.test(request.uri), `/flux/${latestVersions['flux']}/function-types/`);
temporaryRedirect(/\/flux\/v0\.x\/stdlib\/built-in\/transformations\/(\w+\/$)/.test(request.uri), request.uri.replace(/\/flux\/v0\.x\/stdlib\/built-in\/transformations\/(\w+\/$)/, `/flux/${latestVersions['flux']}/stdlib/universe/$1`));
temporaryRedirect(/\/flux\/v0\.x\/stdlib\/built-in\/transformations\/$/.test(request.uri), `/flux/${latestVersions['flux']}/function-types/`);
temporaryRedirect(/\/flux\/v0\.x\/stdlib\/built-in\/$/.test(request.uri), `/flux/${latestVersions['flux']}/stdlib/universe/`);
temporaryRedirect(/\/flux\/v0\.x\/stdlib\/universe\/(?:inputs\/|outputs\/|misc\/|tests\/|transformations\/|selectors\/|aggregates\/)$/.test(request.uri), `/flux/${latestVersions['flux']}/function-types/`);
// Redirect Flux stdlib/influxdb sections to Flux stdlib/influxdata docs
temporaryRedirect(/\/influxdb\/(v2\.[0-9]{1,2}|cloud)\/reference\/flux\/stdlib\/influxdb\//.test(request.uri), request.uri.replace(/\/influxdb\/(?:v2\.[0-9]{1,2}|cloud)\/reference\/flux\/stdlib\/influxdb\//, `/flux/${latestVersions['flux']}/stdlib/influxdata/influxdb/`));
temporaryRedirect(/\/influxdb\/(v2\.[0-9]{1,2}|cloud)\/reference\/flux\/stdlib\/monitor\//.test(request.uri), request.uri.replace(/\/influxdb\/(?:v2\.[0-9]{1,2}|cloud)\/reference\/flux\/stdlib\/monitor\//, `/flux/${latestVersions['flux']}/stdlib/influxdata/influxdb/monitor/`));
@ -157,6 +169,8 @@ exports.handler = (event, context, callback) => {
// Generic Flux stdlib redirect
temporaryRedirect(/\/influxdb\/(v2\.[0-9]{1,2}|cloud)\/reference\/flux\/stdlib\//.test(request.uri), request.uri.replace(/\/influxdb\/(?:v2\.[0-9]{1,2}|cloud)\/reference\/flux\/stdlib\//, `/flux/${latestVersions['flux']}/stdlib/`));
temporaryRedirect(/\/flux\/v0\.x\/functions\//.test(request.uri), request.uri.replace(/(\/flux\/v0\.x\/)functions\/(.*)/, `$1stdlib/$2`));
temporaryRedirect(/\/flux\/v0\.x\/stdlib\/experimental\/to\/.+/.test(request.uri), request.uri.replace(/(\/flux\/v0\.x\/stdlib\/experimental\/)to\/(.+)/, `$1$2`));
// Redirect outdated Chronograf links
temporaryRedirect(/\/flux\/v[0,1]\.x\/stdlib\/built-in\/(?:inputs\/|outputs\/|misc\/|tests\/)(\w+\/$)/.test(request.uri), request.uri.replace(/\/flux\/v[0,1]\.x\/stdlib\/built-in\/(?:inputs\/|outputs\/|misc\/|tests\/)(\w+\/$)/, `/flux/${latestVersions['flux']}/stdlib/universe/$1`));