mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
Merge pull request #264 from creative-commoners/pulls/master/five
ENH Make 5 the default version
This commit is contained in:
commit
f3d5c4781b
@ -36,6 +36,7 @@ For **new stable releases**, you will need to do the following
|
|||||||
- Remove the major from the `PRE_RELEASE` array in the `getVersionMessage` function in `src/utils/nodes.ts`
|
- Remove the major from the `PRE_RELEASE` array in the `getVersionMessage` function in `src/utils/nodes.ts`
|
||||||
- Update the `getDefaultVersion` function's return value to the new stable major in `src/utils/nodes.ts`
|
- Update the `getDefaultVersion` function's return value to the new stable major in `src/utils/nodes.ts`
|
||||||
- Update redirects in `netlify.toml`
|
- Update redirects in `netlify.toml`
|
||||||
|
- Update `index.tsx` to navigate to the new stable major
|
||||||
|
|
||||||
When a **major goes EOL**, add the major to the `EOL` array in the `getVersionMessage` function in `src/utils/nodes.ts`
|
When a **major goes EOL**, add the major to the `EOL` array in the `getVersionMessage` function in `src/utils/nodes.ts`
|
||||||
|
|
||||||
|
@ -144,11 +144,15 @@ exports.createPages = async ({ actions, graphql, getNodesByType }) => {
|
|||||||
|
|
||||||
console.log(`Creating legacy redirects...`);
|
console.log(`Creating legacy redirects...`);
|
||||||
const redirects = new Map();
|
const redirects = new Map();
|
||||||
|
const v5docs = getNodesByType('SilverstripeDocument').filter(n => n.slug.match(/^\/en\/5\//));
|
||||||
const v4docs = getNodesByType('SilverstripeDocument').filter(n => n.slug.match(/^\/en\/4\//));
|
const v4docs = getNodesByType('SilverstripeDocument').filter(n => n.slug.match(/^\/en\/4\//));
|
||||||
const v3docs = getNodesByType('SilverstripeDocument').filter(n => n.slug.match(/^\/en\/3\//));
|
const v3docs = getNodesByType('SilverstripeDocument').filter(n => n.slug.match(/^\/en\/3\//));
|
||||||
|
|
||||||
[...v4docs, ...v3docs].forEach(n => {
|
[...v5docs, ...v4docs, ...v3docs].forEach(n => {
|
||||||
const legacy = n.slug.replace(/^\/en\/[0-9]\//, '/en/');
|
const legacy = n.slug.replace(/^\/en\/[0-9]\//, '/en/');
|
||||||
|
if (legacy === '/en/') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!redirects.has(legacy)) {
|
if (!redirects.has(legacy)) {
|
||||||
redirects.set(legacy, n.slug);
|
redirects.set(legacy, n.slug);
|
||||||
}
|
}
|
||||||
|
18
netlify.toml
18
netlify.toml
@ -2,20 +2,26 @@
|
|||||||
from = "https://doc.silverstripe.org/*"
|
from = "https://doc.silverstripe.org/*"
|
||||||
to = "https://docs.silverstripe.org/:splat"
|
to = "https://docs.silverstripe.org/:splat"
|
||||||
force = true
|
force = true
|
||||||
status = 301
|
status = 302
|
||||||
|
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
from = "/"
|
from = "/"
|
||||||
to = "/en/4/"
|
to = "/en/5/"
|
||||||
|
status = 302
|
||||||
|
|
||||||
|
[[redirects]]
|
||||||
|
from = "/en"
|
||||||
|
to = "/en/5/"
|
||||||
|
status = 302
|
||||||
|
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
from = "/framework/en/*"
|
from = "/framework/en/*"
|
||||||
to = "/en/4/:splat"
|
to = "/en/5/:splat"
|
||||||
status = 301
|
status = 302
|
||||||
|
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
from = "/contributing"
|
from = "/contributing"
|
||||||
to = "/en/4/contributing/"
|
to = "/en/5/contributing/"
|
||||||
|
|
||||||
[[redirects]]
|
[[redirects]]
|
||||||
from = "/en/4/getting_started/installation/common_problems"
|
from = "/en/4/getting_started/installation/common_problems"
|
||||||
|
@ -3,7 +3,7 @@ import { navigate } from '@reach/router'
|
|||||||
|
|
||||||
const IndexPage = () => {
|
const IndexPage = () => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
navigate('/en/4/');
|
navigate('/en/5/');
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return <div />;
|
return <div />;
|
||||||
|
@ -143,7 +143,7 @@ const getHomePage = (): SilverstripeDocument | null => {
|
|||||||
/**
|
/**
|
||||||
* Get the default version
|
* Get the default version
|
||||||
*/
|
*/
|
||||||
const getDefaultVersion = (): string => '4';
|
const getDefaultVersion = (): string => '5';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the selected version
|
* Get the selected version
|
||||||
@ -158,7 +158,7 @@ const getVersionMessage = (): ReactElement | ReactElement[] | string | null => {
|
|||||||
'3',
|
'3',
|
||||||
];
|
];
|
||||||
const PRE_RELEASE = [
|
const PRE_RELEASE = [
|
||||||
'5',
|
'6',
|
||||||
];
|
];
|
||||||
const version = getCurrentVersion();
|
const version = getCurrentVersion();
|
||||||
const stablePath = getVersionPath(getCurrentNode(), getDefaultVersion());
|
const stablePath = getVersionPath(getCurrentNode(), getDefaultVersion());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user